import "github.com/v2ray/v2ray-core/proxy/shadowsocks"
Package shadowsocks provides compatible functionality to Shadowsocks.
Shadowsocks client and server are implemented as outbound and inbound respectively in V2Ray's term.
R.I.P Shadowsocks
client.go config.go config.pb.go errors.generated.go protocol.go server.go shadowsocks.go
const (
Version = 1
)
var ( CipherType_name = map[int32]string{ 0: "UNKNOWN", 1: "AES_128_CFB", 2: "AES_256_CFB", 3: "CHACHA20", 4: "CHACHA20_IETF", 5: "AES_128_GCM", 6: "AES_256_GCM", 7: "CHACHA20_POLY1305", 8: "NONE", } CipherType_value = map[string]int32{ "UNKNOWN": 0, "AES_128_CFB": 1, "AES_256_CFB": 2, "CHACHA20": 3, "CHACHA20_IETF": 4, "AES_128_GCM": 5, "AES_256_GCM": 6, "CHACHA20_POLY1305": 7, "NONE": 8, } )
Enum value maps for CipherType.
var File_proxy_shadowsocks_config_proto protoreflect.FileDescriptor
func DecodeUDPPacket(user *protocol.MemoryUser, payload *buf.Buffer) (*protocol.RequestHeader, *buf.Buffer, error)
func ReadTCPSession(user *protocol.MemoryUser, reader io.Reader) (*protocol.RequestHeader, buf.Reader, error)
ReadTCPSession reads a Shadowsocks TCP session from the given reader, returns its header and remaining parts.
WriteTCPRequest writes Shadowsocks request into the given writer, and returns a writer for body.
type AEADCipher struct { KeyBytes int32 IVBytes int32 AEADAuthCreator func(key []byte) cipher.AEAD }
func (c *AEADCipher) IVSize() int32
func (*AEADCipher) IsAEAD() bool
func (c *AEADCipher) KeySize() int32
func (c *AEADCipher) NewDecryptionReader(key []byte, iv []byte, reader io.Reader) (buf.Reader, error)
func (c *AEADCipher) NewEncryptionWriter(key []byte, iv []byte, writer io.Writer) (buf.Writer, error)
type Account struct { Password string `protobuf:"bytes,1,opt,name=password,proto3" json:"password,omitempty"` CipherType CipherType `protobuf:"varint,2,opt,name=cipher_type,json=cipherType,proto3,enum=v2ray.core.proxy.shadowsocks.CipherType" json:"cipher_type,omitempty"` // contains filtered or unexported fields }
AsAccount implements protocol.AsAccount.
Deprecated: Use Account.ProtoReflect.Descriptor instead.
func (x *Account) GetCipherType() CipherType
func (x *Account) ProtoReflect() protoreflect.Message
AesCfb represents all AES-CFB ciphers.
func (v *ChaCha20) NewDecryptionReader(key []byte, iv []byte, reader io.Reader) (buf.Reader, error)
func (v *ChaCha20) NewEncryptionWriter(key []byte, iv []byte, writer io.Writer) (buf.Writer, error)
type Cipher interface { KeySize() int32 IVSize() int32 NewEncryptionWriter(key []byte, iv []byte, writer io.Writer) (buf.Writer, error) NewDecryptionReader(key []byte, iv []byte, reader io.Reader) (buf.Reader, error) IsAEAD() bool EncodePacket(key []byte, b *buf.Buffer) error DecodePacket(key []byte, b *buf.Buffer) error }
Cipher is an interface for all Shadowsocks ciphers.
const ( CipherType_UNKNOWN CipherType = 0 CipherType_AES_128_CFB CipherType = 1 CipherType_AES_256_CFB CipherType = 2 CipherType_CHACHA20 CipherType = 3 CipherType_CHACHA20_IETF CipherType = 4 CipherType_AES_128_GCM CipherType = 5 CipherType_AES_256_GCM CipherType = 6 CipherType_CHACHA20_POLY1305 CipherType = 7 CipherType_NONE CipherType = 8 )
func (CipherType) Descriptor() protoreflect.EnumDescriptor
func (x CipherType) Enum() *CipherType
func (CipherType) EnumDescriptor() ([]byte, []int)
Deprecated: Use CipherType.Descriptor instead.
func (x CipherType) Number() protoreflect.EnumNumber
func (x CipherType) String() string
func (CipherType) Type() protoreflect.EnumType
type Client struct {
// contains filtered or unexported fields
}
Client is a inbound handler for Shadowsocks protocol
NewClient create a new Shadowsocks client.
Process implements OutboundHandler.Process().
type ClientConfig struct { Server []*protocol.ServerEndpoint `protobuf:"bytes,1,rep,name=server,proto3" json:"server,omitempty"` // contains filtered or unexported fields }
func (*ClientConfig) Descriptor() ([]byte, []int)
Deprecated: Use ClientConfig.ProtoReflect.Descriptor instead.
func (x *ClientConfig) GetServer() []*protocol.ServerEndpoint
func (*ClientConfig) ProtoMessage()
func (x *ClientConfig) ProtoReflect() protoreflect.Message
func (x *ClientConfig) Reset()
func (x *ClientConfig) String() string
MemoryAccount is an account type converted from Account.
func (a *MemoryAccount) Equals(another protocol.Account) bool
Equals implements protocol.Account.Equals().
type NoneCipher struct{}
func (NoneCipher) IVSize() int32
func (NoneCipher) IsAEAD() bool
func (NoneCipher) KeySize() int32
type Server struct {
// contains filtered or unexported fields
}
NewServer create a new Shadowsocks server.
func (s *Server) Process(ctx context.Context, network net.Network, conn internet.Connection, dispatcher routing.Dispatcher) error
type ServerConfig struct { // UdpEnabled specified whether or not to enable UDP for Shadowsocks. // Deprecated. Use 'network' field. // // Deprecated: Do not use. UdpEnabled bool `protobuf:"varint,1,opt,name=udp_enabled,json=udpEnabled,proto3" json:"udp_enabled,omitempty"` User *protocol.User `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"` Network []net.Network `protobuf:"varint,3,rep,packed,name=network,proto3,enum=v2ray.core.common.net.Network" json:"network,omitempty"` // contains filtered or unexported fields }
func (*ServerConfig) Descriptor() ([]byte, []int)
Deprecated: Use ServerConfig.ProtoReflect.Descriptor instead.
func (x *ServerConfig) GetNetwork() []net.Network
func (x *ServerConfig) GetUdpEnabled() bool
Deprecated: Do not use.
func (x *ServerConfig) GetUser() *protocol.User
func (*ServerConfig) ProtoMessage()
func (x *ServerConfig) ProtoReflect() protoreflect.Message
func (x *ServerConfig) Reset()
func (x *ServerConfig) String() string
type UDPReader struct { Reader io.Reader User *protocol.MemoryUser }
func (v *UDPReader) ReadMultiBuffer() (buf.MultiBuffer, error)
type UDPWriter struct { Writer io.Writer Request *protocol.RequestHeader }
Write implements io.Writer.
Package shadowsocks imports 40 packages (graph) and is imported by 2 packages. Updated 2020-10-27. Refresh now. Tools for package owners.