Documentation
¶
Index ¶
- Constants
- Variables
- func ContextWithKeepSession(ctx context.Context) context.Context
- func CreateVectorisedWriter(writer any) (N.VectorisedWriter, bool)
- func DeriveKey(psk []byte, salt []byte) []byte
- func IncreaseNonce(nonce []byte)
- func KeepSessionFromContext(ctx context.Context) bool
- func NewAEAD(key []byte) (cipher.AEAD, error)
- func ReadConnectAddress(reader io.Reader) (M.Socksaddr, error)
- func ReadServerError(record *buf.Buffer) error
- func ReadUDPRequestAddress(buffer *buf.Buffer) (M.Socksaddr, error)
- func ReadUDPResponseAddress(buffer *buf.Buffer) (M.Socksaddr, error)
- func WriteConnectAddress(buffer *buf.Buffer, destination M.Socksaddr) error
- func WriteUDPRequestAddress(buffer *buf.Buffer, destination M.Socksaddr) error
- func WriteUDPResponseAddress(buffer *buf.Buffer, source M.Socksaddr) error
- type CloseHandlerFunc
- type Handler
- type Method
- type ObfsConfig
- type ObfsMode
- type PacketBatchWriteCreator
- type PacketBatchWriter
- type Request
- type ServerError
- type Service
- type VectorisedWriteCreator
Constants ¶
View Source
const ( // Surge 6.4.4 (10661): -[SNObfsHelperHTTP initWithPolicy:] and -[SGObfsHelperTLS initWithPolicy:] // substitute these constants when the policy carries no obfs-host / obfs-uri. DefaultObfsHost = "bing.com" DefaultObfsURI = "/" DefaultTLSObfsHost = "cloudfront.net" )
View Source
const ( HeaderVersion = 0x04 HeaderPlainLen = 7 AEADTagLen = 16 HeaderCipherLen = HeaderPlainLen + AEADTagLen SaltLen = 16 NonceLen = 12 MaxPayloadLen = 0x3fff )
View Source
const ( CommandPing = 0x00 CommandConnect = 0x01 CommandConnectV2 = 0x05 CommandUDP = 0x06 )
View Source
const ( ReplyTunnel = 0x00 ReplyPong = 0x01 ReplyError = 0x02 )
View Source
const ( UDPCommandForward = 0x01 AddressTypeIPv4 = 0x04 AddressTypeIPv6 = 0x06 )
View Source
const RequestVersion = 0x01
Variables ¶
View Source
var ( ErrBadVersion = E.New("snell: bad header version") ErrReservedNonZero = E.New("snell: reserved header octet is non-zero") ErrPayloadTooLarge = E.New("snell: payload length exceeds maximum") ErrUnsupportedCommand = E.New("snell: unsupported command") ErrUnexpectedReply = E.New("snell: unexpected reply opcode") ErrMissingPSK = E.New("snell: missing pre-shared key") ErrNoUsers = E.New("snell: no users") ErrBadUserKey = E.New("snell: bad user key") ErrDuplicateUserKey = E.New("snell: duplicate user key") )
Functions ¶
func CreateVectorisedWriter ¶
func CreateVectorisedWriter(writer any) (N.VectorisedWriter, bool)
CreateVectorisedWriter preserves Snell's lazy record writer while using MetaCubeX/sing for buffers and the underlying scatter/gather implementation.
func DeriveKey ¶
Surge 6.7.0 (11520): FUN_1000123d0: AEAD keys are derived with these Argon2id parameters.
func IncreaseNonce ¶
func IncreaseNonce(nonce []byte)
Surge 6.7.0 (11520): FUN_100012944: nonce is u64le(counter) || 0x00000000.
func KeepSessionFromContext ¶
func ReadServerError ¶
func WriteConnectAddress ¶
Surge 6.7.0 (11520): SNConnectorV4::targetHandshakeData: CONNECT targets are host strings even for literal IPs.
func WriteUDPRequestAddress ¶
Types ¶
type CloseHandlerFunc ¶
type CloseHandlerFunc = func(error)
CloseHandlerFunc completes a logical request, which may share a reusable transport. Closing the transport is not a substitute for this callback.
type ObfsConfig ¶
func (ObfsConfig) ClientConn ¶
func (c ObfsConfig) ClientConn(conn net.Conn) net.Conn
func (ObfsConfig) ServerConn ¶
func (c ObfsConfig) ServerConn(conn net.Conn) net.Conn
type PacketBatchWriteCreator ¶
type PacketBatchWriteCreator interface {
CreatePacketBatchWriter() (PacketBatchWriter, bool)
}
type PacketBatchWriter ¶
type PacketBatchWriter interface {
WritePacketBatch(buffers []*buf.Buffer, destinations []M.Socksaddr) error
}
func CreatePacketBatchWriter ¶
func CreatePacketBatchWriter(writer N.PacketWriter) (PacketBatchWriter, bool)
type ServerError ¶
snell-server v6.0.0b4: FUN_00141bc0: malformed handshakes are torn down abruptly.
func (*ServerError) Error ¶
func (e *ServerError) Error() string
func (*ServerError) Unwrap ¶
func (e *ServerError) Unwrap() error
type VectorisedWriteCreator ¶
type VectorisedWriteCreator interface {
CreateVectorisedWriter() (N.VectorisedWriter, bool)
}
Click to show internal directories.
Click to hide internal directories.