Documentation ¶
Overview ¶
Package shadowsocks provides compatible functionality to Shadowsocks.
Shadowsocks client and server are implemented as outbound and inbound respectively in V2Ray's term.
Shadowsocks OTA is fully supported. By default both client and server enable OTA, but it can be optionally disabled.
Supperted Ciphers: * AES-256-CFB * AES-128-CFB * Chacha20 * Chacha20-IEFT
R.I.P Shadowsocks
Index ¶
- Constants
- Variables
- func ChunkKeyGenerator(iv []byte) func() []byte
- func DecodeUDPPacket(user *protocol.User, payload *buf.Buffer) (*protocol.RequestHeader, *buf.Buffer, error)
- func EncodeUDPPacket(request *protocol.RequestHeader, payload *buf.Buffer) (*buf.Buffer, error)
- func HeaderKeyGenerator(key []byte, iv []byte) func() []byte
- func PasswordToCipherKey(password string, keySize int) []byte
- func ReadTCPResponse(user *protocol.User, reader io.Reader) (buf.Reader, error)
- func ReadTCPSession(user *protocol.User, reader io.Reader) (*protocol.RequestHeader, buf.Reader, error)
- func WriteTCPRequest(request *protocol.RequestHeader, writer io.Writer) (buf.Writer, error)
- func WriteTCPResponse(request *protocol.RequestHeader, writer io.Writer) (buf.Writer, error)
- type Account
- func (v *Account) AsAccount() (protocol.Account, error)
- func (*Account) Descriptor() ([]byte, []int)
- func (v *Account) GetCipher() (Cipher, error)
- func (v *Account) GetCipherKey() []byte
- func (m *Account) GetCipherType() CipherType
- func (m *Account) GetOta() Account_OneTimeAuth
- func (m *Account) GetPassword() string
- func (*Account) ProtoMessage()
- func (m *Account) Reset()
- func (m *Account) String() string
- type Account_OneTimeAuth
- type AesCfb
- type Authenticator
- type ChaCha20
- type ChunkReader
- type ChunkWriter
- type Cipher
- type CipherType
- type Client
- type ClientConfig
- type KeyGenerator
- type Server
- type ServerConfig
- type ShadowsocksAccount
- type UDPReader
- type UDPWriter
Constants ¶
View Source
const ( Version = 1 RequestOptionOneTimeAuth = protocol.RequestOption(101) AddrTypeIPv4 = 1 AddrTypeIPv6 = 4 AddrTypeDomain = 3 )
View Source
const (
// AuthSize is the number of extra bytes for Shadowsocks OTA.
AuthSize = 10
)
Variables ¶
View Source
var Account_OneTimeAuth_name = map[int32]string{
0: "Auto",
1: "Disabled",
2: "Enabled",
}
View Source
var Account_OneTimeAuth_value = map[string]int32{
"Auto": 0,
"Disabled": 1,
"Enabled": 2,
}
Functions ¶
func DecodeUDPPacket ¶
func EncodeUDPPacket ¶
func ReadTCPResponse ¶
func ReadTCPSession ¶
func WriteTCPRequest ¶
Types ¶
type Account ¶
type Account struct { Password string `protobuf:"bytes,1,opt,name=password" json:"password,omitempty"` CipherType CipherType `` /* 130-byte string literal not displayed */ Ota Account_OneTimeAuth `protobuf:"varint,3,opt,name=ota,enum=v2ray.core.proxy.shadowsocks.Account_OneTimeAuth" json:"ota,omitempty"` }
func (*Account) GetCipherType ¶
func (m *Account) GetCipherType() CipherType
func (*Account) GetOta ¶
func (m *Account) GetOta() Account_OneTimeAuth
type Account_OneTimeAuth ¶
type Account_OneTimeAuth int32
const ( Account_Auto Account_OneTimeAuth = 0 Account_Disabled Account_OneTimeAuth = 1 Account_Enabled Account_OneTimeAuth = 2 )
func (Account_OneTimeAuth) EnumDescriptor ¶
func (Account_OneTimeAuth) EnumDescriptor() ([]byte, []int)
func (Account_OneTimeAuth) String ¶
func (x Account_OneTimeAuth) String() string
type Authenticator ¶
type Authenticator struct {
// contains filtered or unexported fields
}
func NewAuthenticator ¶
func NewAuthenticator(keygen KeyGenerator) *Authenticator
func (*Authenticator) Authenticate ¶
func (v *Authenticator) Authenticate(data []byte) buf.Supplier
type ChunkReader ¶
type ChunkReader struct {
// contains filtered or unexported fields
}
func NewChunkReader ¶
func NewChunkReader(reader io.Reader, auth *Authenticator) *ChunkReader
func (*ChunkReader) Read ¶
func (v *ChunkReader) Read() (*buf.Buffer, error)
type ChunkWriter ¶
type ChunkWriter struct {
// contains filtered or unexported fields
}
func NewChunkWriter ¶
func NewChunkWriter(writer io.Writer, auth *Authenticator) *ChunkWriter
func (*ChunkWriter) Write ¶
func (v *ChunkWriter) Write(payload *buf.Buffer) error
type Cipher ¶
type CipherType ¶
type CipherType int32
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 )
func (CipherType) EnumDescriptor ¶
func (CipherType) EnumDescriptor() ([]byte, []int)
func (CipherType) String ¶
func (x CipherType) String() string
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a inbound handler for Shadowsocks protocol
type ClientConfig ¶
type ClientConfig struct {
Server []*v2ray_core_common_protocol1.ServerEndpoint `protobuf:"bytes,1,rep,name=server" json:"server,omitempty"`
}
func (*ClientConfig) Descriptor ¶
func (*ClientConfig) Descriptor() ([]byte, []int)
func (*ClientConfig) GetServer ¶
func (m *ClientConfig) GetServer() []*v2ray_core_common_protocol1.ServerEndpoint
func (*ClientConfig) ProtoMessage ¶
func (*ClientConfig) ProtoMessage()
func (*ClientConfig) Reset ¶
func (m *ClientConfig) Reset()
func (*ClientConfig) String ¶
func (m *ClientConfig) String() string
type Server ¶ added in v1.12.9
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶ added in v1.12.9
func NewServer(ctx context.Context, config *ServerConfig) (*Server, error)
func (*Server) Network ¶
func (s *Server) Network() net.NetworkList
type ServerConfig ¶
type ServerConfig struct { UdpEnabled bool `protobuf:"varint,1,opt,name=udp_enabled,json=udpEnabled" json:"udp_enabled,omitempty"` User *v2ray_core_common_protocol.User `protobuf:"bytes,2,opt,name=user" json:"user,omitempty"` }
func (*ServerConfig) Descriptor ¶
func (*ServerConfig) Descriptor() ([]byte, []int)
func (*ServerConfig) GetUdpEnabled ¶
func (m *ServerConfig) GetUdpEnabled() bool
func (*ServerConfig) GetUser ¶
func (m *ServerConfig) GetUser() *v2ray_core_common_protocol.User
func (*ServerConfig) ProtoMessage ¶
func (*ServerConfig) ProtoMessage()
func (*ServerConfig) Reset ¶
func (m *ServerConfig) Reset()
func (*ServerConfig) String ¶
func (m *ServerConfig) String() string
type ShadowsocksAccount ¶
type ShadowsocksAccount struct { Cipher Cipher Key []byte OneTimeAuth Account_OneTimeAuth }
func (*ShadowsocksAccount) Equals ¶
func (v *ShadowsocksAccount) Equals(another protocol.Account) bool
type UDPReader ¶
Click to show internal directories.
Click to hide internal directories.