Documentation ¶
Index ¶
- Constants
- Variables
- type AEADChunkSizeParser
- type AES128GCMMethod
- func (a AES128GCMMethod) GenerateEIH(currentIdentitySubKey []byte, nextPskHash []byte, out []byte) error
- func (a AES128GCMMethod) GetSessionSubKeyAndSaltLength() int
- func (a AES128GCMMethod) GetStreamAEAD(sessionSubKey []byte) (cipher.AEAD, error)
- func (a AES128GCMMethod) GetUDPClientProcessor(ipsk [][]byte, psk []byte, derivation KeyDerivation) (UDPClientPacketProcessor, error)
- type AES256GCMMethod
- func (a AES256GCMMethod) GenerateEIH(currentIdentitySubKey []byte, nextPskHash []byte, out []byte) error
- func (a AES256GCMMethod) GetSessionSubKeyAndSaltLength() int
- func (a AES256GCMMethod) GetStreamAEAD(sessionSubKey []byte) (cipher.AEAD, error)
- func (a AES256GCMMethod) GetUDPClientProcessor(ipsk [][]byte, psk []byte, derivation KeyDerivation) (UDPClientPacketProcessor, error)
- type AESUDPClientPacketProcessor
- type BLAKE3KeyDerivation
- type Client
- type ClientConfig
- func (*ClientConfig) Descriptor() ([]byte, []int)deprecated
- func (x *ClientConfig) GetAddress() *net.IPOrDomain
- func (x *ClientConfig) GetIpsk() [][]byte
- func (x *ClientConfig) GetMethod() string
- func (x *ClientConfig) GetPort() uint32
- func (x *ClientConfig) GetPsk() []byte
- func (*ClientConfig) ProtoMessage()
- func (x *ClientConfig) ProtoReflect() protoreflect.Message
- func (x *ClientConfig) Reset()
- func (x *ClientConfig) String() string
- type ClientUDPConnState
- type ClientUDPSession
- func (c *ClientUDPSession) Close() error
- func (c *ClientUDPSession) GetCachedServerState(serverSessionID string) UDPClientPacketProcessorCachedState
- func (c *ClientUDPSession) GetCachedState(sessionID string) UDPClientPacketProcessorCachedState
- func (c *ClientUDPSession) KeepReading()
- func (c *ClientUDPSession) NewSessionConn() (internet.AbstractPacketConn, error)
- func (c *ClientUDPSession) PutCachedServerState(serverSessionID string, cache UDPClientPacketProcessorCachedState)
- func (c *ClientUDPSession) PutCachedState(sessionID string, cache UDPClientPacketProcessorCachedState)
- func (c *ClientUDPSession) WriteUDPRequest(request *UDPRequest) error
- type ClientUDPSessionConn
- type ClientUDPSessionServerTracker
- type DestinationAddress
- type ExtensibleIdentityHeaders
- type KeyDerivation
- type Method
- type RequestSalt
- type TCPRequest
- func (t *TCPRequest) CheckC2SConnectionConstraint() error
- func (t *TCPRequest) CreateClientC2SWriter(writer io.Writer) buf.Writer
- func (t *TCPRequest) CreateClientS2CReader(in io.Reader, initialPayload *buf.Buffer) (buf.Reader, error)
- func (t *TCPRequest) DecodeTCPResponseHeader(effectivePsk []byte, in io.Reader) error
- func (t *TCPRequest) EncodeTCPRequestHeader(effectivePsk []byte, eih [][]byte, address DestinationAddress, destPort int, ...) error
- type TCPRequestHeader
- type TCPRequestHeader1PreSessionKey
- type TCPRequestHeader2FixedLength
- type TCPRequestHeader3VariableLength
- type TCPResponseHeader
- type TCPResponseHeader1PreSessionKey
- type TCPResponseHeader2FixedLength
- type UDPClientPacketProcessor
- type UDPClientPacketProcessorCachedState
- type UDPClientPacketProcessorCachedStateContainer
- type UDPRequest
- type UDPResponse
Constants ¶
View Source
const ( TCPHeaderTypeClientToServerStream = byte(0x00) TCPHeaderTypeServerToClientStream = byte(0x01) TCPMinPaddingLength = 0 TCPMaxPaddingLength = 900 )
View Source
const ( UDPHeaderTypeClientToServerStream = byte(0x00) UDPHeaderTypeServerToClientStream = byte(0x01) )
View Source
const UDPConnectionState = "UDPConnectionState"
Variables ¶
View Source
var File_proxy_shadowsocks2022_config_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type AEADChunkSizeParser ¶ added in v5.12.1
type AEADChunkSizeParser struct {
Auth *crypto.AEADAuthenticator
}
func (*AEADChunkSizeParser) Decode ¶ added in v5.12.1
func (p *AEADChunkSizeParser) Decode(b []byte) (uint16, error)
func (*AEADChunkSizeParser) Encode ¶ added in v5.12.1
func (p *AEADChunkSizeParser) Encode(size uint16, b []byte) []byte
func (*AEADChunkSizeParser) HasConstantOffset ¶ added in v5.12.1
func (p *AEADChunkSizeParser) HasConstantOffset() uint16
func (*AEADChunkSizeParser) SizeBytes ¶ added in v5.12.1
func (p *AEADChunkSizeParser) SizeBytes() int32
type AES128GCMMethod ¶
type AES128GCMMethod struct{}
func (AES128GCMMethod) GenerateEIH ¶
func (a AES128GCMMethod) GenerateEIH(currentIdentitySubKey []byte, nextPskHash []byte, out []byte) error
func (AES128GCMMethod) GetSessionSubKeyAndSaltLength ¶
func (a AES128GCMMethod) GetSessionSubKeyAndSaltLength() int
func (AES128GCMMethod) GetStreamAEAD ¶
func (a AES128GCMMethod) GetStreamAEAD(sessionSubKey []byte) (cipher.AEAD, error)
func (AES128GCMMethod) GetUDPClientProcessor ¶
func (a AES128GCMMethod) GetUDPClientProcessor(ipsk [][]byte, psk []byte, derivation KeyDerivation) (UDPClientPacketProcessor, error)
type AES256GCMMethod ¶
type AES256GCMMethod struct{}
func (AES256GCMMethod) GenerateEIH ¶
func (a AES256GCMMethod) GenerateEIH(currentIdentitySubKey []byte, nextPskHash []byte, out []byte) error
func (AES256GCMMethod) GetSessionSubKeyAndSaltLength ¶
func (a AES256GCMMethod) GetSessionSubKeyAndSaltLength() int
func (AES256GCMMethod) GetStreamAEAD ¶
func (a AES256GCMMethod) GetStreamAEAD(sessionSubKey []byte) (cipher.AEAD, error)
func (AES256GCMMethod) GetUDPClientProcessor ¶
func (a AES256GCMMethod) GetUDPClientProcessor(ipsk [][]byte, psk []byte, derivation KeyDerivation) (UDPClientPacketProcessor, error)
type AESUDPClientPacketProcessor ¶
type AESUDPClientPacketProcessor struct { EIHGenerator func([]byte) ExtensibleIdentityHeaders // contains filtered or unexported fields }
func NewAESUDPClientPacketProcessor ¶
func NewAESUDPClientPacketProcessor(requestSeparateHeaderBlockCipher, responseSeparateHeaderBlockCipher cipher.Block, mainPacketAEAD func([]byte) cipher.AEAD, eih func([]byte) ExtensibleIdentityHeaders) *AESUDPClientPacketProcessor
func (*AESUDPClientPacketProcessor) DecodeUDPResp ¶
func (p *AESUDPClientPacketProcessor) DecodeUDPResp(input []byte, resp *UDPResponse, cache UDPClientPacketProcessorCachedStateContainer, ) error
func (*AESUDPClientPacketProcessor) EncodeUDPRequest ¶
func (p *AESUDPClientPacketProcessor) EncodeUDPRequest(request *UDPRequest, out *buf.Buffer, cache UDPClientPacketProcessorCachedStateContainer, ) error
type BLAKE3KeyDerivation ¶
type BLAKE3KeyDerivation struct{}
func (BLAKE3KeyDerivation) GetIdentitySubKey ¶
func (b BLAKE3KeyDerivation) GetIdentitySubKey(effectivePsk, salt []byte, outKey []byte) error
func (BLAKE3KeyDerivation) GetSessionSubKey ¶
func (b BLAKE3KeyDerivation) GetSessionSubKey(effectivePsk, salt []byte, outKey []byte) error
type ClientConfig ¶
type ClientConfig struct { Method string `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"` Psk []byte `protobuf:"bytes,2,opt,name=psk,proto3" json:"psk,omitempty"` Ipsk [][]byte `protobuf:"bytes,4,rep,name=ipsk,proto3" json:"ipsk,omitempty"` Address *net.IPOrDomain `protobuf:"bytes,5,opt,name=address,proto3" json:"address,omitempty"` Port uint32 `protobuf:"varint,6,opt,name=port,proto3" json:"port,omitempty"` // contains filtered or unexported fields }
func (*ClientConfig) Descriptor
deprecated
func (*ClientConfig) Descriptor() ([]byte, []int)
Deprecated: Use ClientConfig.ProtoReflect.Descriptor instead.
func (*ClientConfig) GetAddress ¶
func (x *ClientConfig) GetAddress() *net.IPOrDomain
func (*ClientConfig) GetIpsk ¶
func (x *ClientConfig) GetIpsk() [][]byte
func (*ClientConfig) GetMethod ¶
func (x *ClientConfig) GetMethod() string
func (*ClientConfig) GetPort ¶
func (x *ClientConfig) GetPort() uint32
func (*ClientConfig) GetPsk ¶
func (x *ClientConfig) GetPsk() []byte
func (*ClientConfig) ProtoMessage ¶
func (*ClientConfig) ProtoMessage()
func (*ClientConfig) ProtoReflect ¶
func (x *ClientConfig) ProtoReflect() protoreflect.Message
func (*ClientConfig) Reset ¶
func (x *ClientConfig) Reset()
func (*ClientConfig) String ¶
func (x *ClientConfig) String() string
type ClientUDPConnState ¶
type ClientUDPConnState struct {
// contains filtered or unexported fields
}
func NewClientUDPConnState ¶
func NewClientUDPConnState() (*ClientUDPConnState, error)
func (*ClientUDPConnState) GetOrCreateSession ¶
func (c *ClientUDPConnState) GetOrCreateSession(create func() (*ClientUDPSession, error)) (*ClientUDPSession, error)
type ClientUDPSession ¶
type ClientUDPSession struct {
// contains filtered or unexported fields
}
func NewClientUDPSession ¶
func NewClientUDPSession(ctx context.Context, conn io.ReadWriteCloser, packetProcessor UDPClientPacketProcessor) *ClientUDPSession
func (*ClientUDPSession) Close ¶
func (c *ClientUDPSession) Close() error
func (*ClientUDPSession) GetCachedServerState ¶ added in v5.12.1
func (c *ClientUDPSession) GetCachedServerState(serverSessionID string) UDPClientPacketProcessorCachedState
func (*ClientUDPSession) GetCachedState ¶ added in v5.12.1
func (c *ClientUDPSession) GetCachedState(sessionID string) UDPClientPacketProcessorCachedState
func (*ClientUDPSession) KeepReading ¶
func (c *ClientUDPSession) KeepReading()
func (*ClientUDPSession) NewSessionConn ¶
func (c *ClientUDPSession) NewSessionConn() (internet.AbstractPacketConn, error)
func (*ClientUDPSession) PutCachedServerState ¶ added in v5.12.1
func (c *ClientUDPSession) PutCachedServerState(serverSessionID string, cache UDPClientPacketProcessorCachedState)
func (*ClientUDPSession) PutCachedState ¶ added in v5.12.1
func (c *ClientUDPSession) PutCachedState(sessionID string, cache UDPClientPacketProcessorCachedState)
func (*ClientUDPSession) WriteUDPRequest ¶
func (c *ClientUDPSession) WriteUDPRequest(request *UDPRequest) error
type ClientUDPSessionConn ¶
type ClientUDPSessionConn struct {
// contains filtered or unexported fields
}
func (*ClientUDPSessionConn) Close ¶
func (c *ClientUDPSessionConn) Close() error
type ClientUDPSessionServerTracker ¶ added in v5.12.1
type ClientUDPSessionServerTracker struct {
// contains filtered or unexported fields
}
type DestinationAddress ¶
type KeyDerivation ¶
type Method ¶
type Method interface { GetSessionSubKeyAndSaltLength() int GetStreamAEAD(SessionSubKey []byte) (cipher.AEAD, error) GenerateEIH(CurrentIdentitySubKey []byte, nextPskHash []byte, out []byte) error GetUDPClientProcessor(ipsk [][]byte, psk []byte, derivation KeyDerivation) (UDPClientPacketProcessor, error) }
type RequestSalt ¶
type TCPRequest ¶
type TCPRequest struct {
// contains filtered or unexported fields
}
func (*TCPRequest) CheckC2SConnectionConstraint ¶
func (t *TCPRequest) CheckC2SConnectionConstraint() error
func (*TCPRequest) CreateClientC2SWriter ¶
func (t *TCPRequest) CreateClientC2SWriter(writer io.Writer) buf.Writer
func (*TCPRequest) CreateClientS2CReader ¶
func (*TCPRequest) DecodeTCPResponseHeader ¶
func (t *TCPRequest) DecodeTCPResponseHeader(effectivePsk []byte, in io.Reader) error
func (*TCPRequest) EncodeTCPRequestHeader ¶
func (t *TCPRequest) EncodeTCPRequestHeader(effectivePsk []byte, eih [][]byte, address DestinationAddress, destPort int, initialPayload []byte, out *buf.Buffer, ) error
type TCPRequestHeader ¶
type TCPRequestHeader struct { PreSessionKeyHeader TCPRequestHeader1PreSessionKey FixedLengthHeader TCPRequestHeader2FixedLength Header TCPRequestHeader3VariableLength }
type TCPRequestHeader1PreSessionKey ¶
type TCPRequestHeader1PreSessionKey struct { Salt RequestSalt EIH ExtensibleIdentityHeaders }
type TCPRequestHeader3VariableLength ¶
type TCPRequestHeader3VariableLength struct { DestinationAddress DestinationAddress Contents struct { PaddingLength uint16 `struc:"sizeof=Padding"` Padding []byte } }
type TCPResponseHeader ¶
type TCPResponseHeader struct { PreSessionKeyHeader TCPResponseHeader1PreSessionKey Header TCPResponseHeader2FixedLength }
type TCPResponseHeader1PreSessionKey ¶
type TCPResponseHeader1PreSessionKey struct {
Salt RequestSalt
}
type TCPResponseHeader2FixedLength ¶
type TCPResponseHeader2FixedLength struct { Type byte Timestamp uint64 RequestSalt RequestSalt InitialPayloadLength uint16 }
type UDPClientPacketProcessor ¶
type UDPClientPacketProcessor interface { EncodeUDPRequest(request *UDPRequest, out *buf.Buffer, cache UDPClientPacketProcessorCachedStateContainer) error DecodeUDPResp(input []byte, resp *UDPResponse, cache UDPClientPacketProcessorCachedStateContainer) error }
UDPClientPacketProcessor Caller retain and receive all ownership of the buffer
type UDPClientPacketProcessorCachedState ¶ added in v5.12.1
type UDPClientPacketProcessorCachedState interface{}
type UDPClientPacketProcessorCachedStateContainer ¶ added in v5.12.1
type UDPClientPacketProcessorCachedStateContainer interface { GetCachedState(sessionID string) UDPClientPacketProcessorCachedState PutCachedState(sessionID string, cache UDPClientPacketProcessorCachedState) GetCachedServerState(serverSessionID string) UDPClientPacketProcessorCachedState PutCachedServerState(serverSessionID string, cache UDPClientPacketProcessorCachedState) }
type UDPRequest ¶
type UDPResponse ¶
type UDPResponse struct { UDPRequest ClientSessionID [8]byte }
Click to show internal directories.
Click to hide internal directories.