Documentation ¶
Overview ¶
message contains SOCKS 6 wireformat parser and serializer
Index ¶
- Constants
- Variables
- func ConvertNetIPAddrPort(addr net.Addr) netip.AddrPort
- func GetAssociationID(b []byte) uint64
- func NewErrVersionMismatch(v int, b []byte) error
- func SetOptionDataParser(kind OptionKind, fn func([]byte) (OptionData, error))
- func SetStackOptionDataParser(lv StackOptionLevel, code StackOptionCode, ...)
- func SplitStackOptionID(id int) (StackOptionLevel, StackOptionCode)
- func StackOptionID(level StackOptionLevel, code StackOptionCode) int
- type AddressType
- type AuthenticationDataOptionData
- type AuthenticationMethodAdvertisementOptionData
- type AuthenticationMethodSelectionOptionData
- type AuthenticationReply
- type AuthenticationReplyType
- type BacklogOptionData
- type BaseStackOptionData
- type CommandCode
- type Handshake
- type HappyEyeballOptionData
- type IdempotenceAcceptedOptionData
- type IdempotenceExpenditureOptionData
- type IdempotenceRejectedOptionData
- type IdempotenceWindowOptionData
- type MethodSelection
- type MultipathOptionData
- type NoFragmentationOptionData
- type OperationReply
- type Option
- func GetCombinedStackOptions(client StackOptionInfo, remote StackOptionInfo) []Option
- func NewAuthenticationDataOption(method byte, data []byte) Option
- func NewAuthenticationMethodAdvertisementOption(methods []byte, dataLen uint16) Option
- func NewAuthenticationMethodSelectionOption(method byte) Option
- func NewBacklogOption(backlog uint16) Option
- func NewIdempotenceAcceptedOption() Option
- func NewIdempotenceExpenditureOption(token uint32) Option
- func NewIdempotenceRejectedOption() Option
- func NewIdempotenceWindowOption(base, size uint32) Option
- func NewPortParityOption(parity byte, reserve bool) Option
- func NewSessionIDOption(id []byte) Option
- func NewSessionInvalidOption() Option
- func NewSessionOKOption() Option
- func NewSessionRequestOption() Option
- func NewSessionTeardownOption() Option
- func NewTOSOption(client bool, tos byte) Option
- func NewTTLOption(client bool, ttl byte) Option
- func NewTokenRequestOption(size uint32) Option
- func NewUDPErrorOption(availability bool) Option
- func ParseOptionFrom(b io.Reader) (Option, error)
- type OptionData
- type OptionKind
- type OptionSet
- func (s *OptionSet) Add(o ...Option)
- func (s *OptionSet) GetData(kind OptionKind) (OptionData, bool)
- func (s *OptionSet) GetDataF(kind OptionKind, fn func(Option) bool) (OptionData, bool)
- func (s *OptionSet) GetKind(kind OptionKind) []Option
- func (s *OptionSet) GetKindF(kind OptionKind, fn func(Option) bool) []Option
- func (s *OptionSet) Len() int
- func (s *OptionSet) Marshal() []byte
- func (s OptionSet) String() string
- type PortParityOptionData
- type RawOptionData
- type ReplyCode
- type Request
- type SessionIDOptionData
- type SessionInvalidOptionData
- type SessionOKOptionData
- type SessionRequestOptionData
- type SessionTeardownOptionData
- type SocksAddr
- func AddrFromNetIPAddrPort(a netip.AddrPort) SocksAddr
- func ConvertSocksAddr(addr net.Addr) SocksAddr
- func MustParseAddr(addr string) SocksAddr
- func ParseAddr(address string) (SocksAddr, error)
- func ParseSocksAddr5From(b io.Reader) (SocksAddr, error)
- func ParseSocksAddr6From(b io.Reader) (address SocksAddr, padding byte, nConsume int, err error)
- func ParseSocksAddr6FromWithLimit(b io.Reader, limit int) (address SocksAddr, padding byte, nConsume int, err error)
- func (a SocksAddr) AddrPort() netip.AddrPort
- func (a SocksAddr) AddressType() AddressType
- func (a SocksAddr) Domain() string
- func (a SocksAddr) IP() netip.Addr
- func (a SocksAddr) IsIP() bool
- func (a SocksAddr) Marshal5() []byte
- func (a *SocksAddr) Marshal6(pad byte) []byte
- func (a SocksAddr) Network() string
- func (a SocksAddr) Port() uint16
- func (a SocksAddr) String() string
- type StackOptionCode
- type StackOptionData
- type StackOptionInfo
- type StackOptionLevel
- type StreamIDOptionData
- type TFOOptionData
- type TOSOptionData
- type TTLOptionData
- type TokenRequestOptionData
- type UDPErrorOptionData
- type UDPErrorType
- type UDPHeaderType
- type UDPMessage
- type VersionMismatchError
Constants ¶
const ( Socks5Version = 5 MaxOptionSize = 20 * 1024 )
const ( // lv1. StackOptionIPTOS = int(StackOptionLevelIP)*256 + int(StackOptionCodeTOS) StackOptionIPHappyEyeball = int(StackOptionLevelIP)*256 + int(StackOptionCodeHappyEyeball) StackOptionIPTTL = int(StackOptionLevelIP)*256 + int(StackOptionCodeTTL) StackOptionIPNoFragment = int(StackOptionLevelIP)*256 + int(StackOptionCodeNoFragment) // lv4. StackOptionTCPTFO = int(StackOptionLevelTCP)*256 + int(StackOptionCodeTFO) StackOptionTCPMultipath = int(StackOptionLevelTCP)*256 + int(StackOptionCodeMultipath) StackOptionTCPBacklog = int(StackOptionLevelTCP)*256 + int(StackOptionCodeBacklog) // lv5. StackOptionUDPUDPError = int(StackOptionLevelUDP)*256 + int(StackOptionCodeUDPError) StackOptionUDPPortParity = int(StackOptionLevelUDP)*256 + int(StackOptionCodePortParity) )
const ( StackPortParityOptionParityNo byte = 0 StackPortParityOptionParityEven byte = 1 StackPortParityOptionParityOdd byte = 2 )
Variables ¶
var ErrAddressTypeNotSupport = common.LeveledError{ Message: "unsupported address type", Base: ErrMessageProcess, Level: lg.LvError, }
var ErrBufferSize = common.LeveledError{ Message: "invalid buffer size", Base: ErrMessageProcess, Level: lg.LvWarning, }
var ErrEnumValue = common.LeveledError{ Message: "invalid enum value", Base: ErrMessageProcess, Level: lg.LvError, }
var ErrFormat = common.LeveledError{ Message: "format error", Base: ErrMessageProcess, Level: lg.LvError, }
var ErrMessageProcess = errors.New("message error")
var ErrOptionTooLong = common.LeveledError{ Message: "option too long", Base: ErrMessageProcess, Level: lg.LvWarning, }
var ErrStackOptionNoLeg = common.LeveledError{ Message: "stack option should have at least one leg", Base: ErrMessageProcess, Level: lg.LvWarning, }
Functions ¶
func ConvertNetIPAddrPort ¶
ConvertNetIPAddrPort convert net.Addr to netip.AddrPort, when fail, return default netip.AddrPort.
func GetAssociationID ¶
func NewErrVersionMismatch ¶
func SetOptionDataParser ¶
func SetOptionDataParser(kind OptionKind, fn func([]byte) (OptionData, error))
SetOptionDataParser set the option data parse function for given kind to fn set fn to nil to clear parser.
func SetStackOptionDataParser ¶
func SetStackOptionDataParser(lv StackOptionLevel, code StackOptionCode, fn func([]byte) (StackOptionData, error))
SetStackOptionDataParser set the stack option data parse function for given level and code to fn set fn to nil to clear parser.
func SplitStackOptionID ¶
func SplitStackOptionID(id int) (StackOptionLevel, StackOptionCode)
func StackOptionID ¶
func StackOptionID(level StackOptionLevel, code StackOptionCode) int
Types ¶
type AddressType ¶
type AddressType byte
const ( AddressTypeIPv4 AddressType = 1 AddressTypeDomainName AddressType = 3 AddressTypeIPv6 AddressType = 4 )
type AuthenticationDataOptionData ¶
func (AuthenticationDataOptionData) Len ¶
func (s AuthenticationDataOptionData) Len() uint16
func (AuthenticationDataOptionData) Marshal ¶
func (s AuthenticationDataOptionData) Marshal() []byte
type AuthenticationMethodAdvertisementOptionData ¶
func (AuthenticationMethodAdvertisementOptionData) Len ¶
func (a AuthenticationMethodAdvertisementOptionData) Len() uint16
func (AuthenticationMethodAdvertisementOptionData) Marshal ¶
func (a AuthenticationMethodAdvertisementOptionData) Marshal() []byte
type AuthenticationMethodSelectionOptionData ¶
type AuthenticationMethodSelectionOptionData struct {
Method byte
}
func (AuthenticationMethodSelectionOptionData) Marshal ¶
func (s AuthenticationMethodSelectionOptionData) Marshal() []byte
type AuthenticationReply ¶
type AuthenticationReply struct { Type AuthenticationReplyType Options *OptionSet }
func NewAuthenticationReply ¶
func NewAuthenticationReply() *AuthenticationReply
func NewAuthenticationReplyWithType ¶
func NewAuthenticationReplyWithType(typ AuthenticationReplyType) *AuthenticationReply
func ParseAuthenticationReplyFrom ¶
func ParseAuthenticationReplyFrom(b io.Reader) (*AuthenticationReply, error)
func (*AuthenticationReply) Marshal ¶
func (a *AuthenticationReply) Marshal() []byte
type AuthenticationReplyType ¶
type AuthenticationReplyType byte
const ( AuthenticationReplySuccess AuthenticationReplyType = 0 AuthenticationReplyFail AuthenticationReplyType = 1 )
type BacklogOptionData ¶
type BacklogOptionData struct {
Backlog uint16
}
func (BacklogOptionData) GetData ¶
func (t BacklogOptionData) GetData() interface{}
func (BacklogOptionData) Len ¶
func (t BacklogOptionData) Len() uint16
func (BacklogOptionData) Marshal ¶
func (t BacklogOptionData) Marshal() []byte
func (*BacklogOptionData) SetData ¶
func (t *BacklogOptionData) SetData(d interface{})
func (*BacklogOptionData) SetUint16 ¶
func (t *BacklogOptionData) SetUint16(b uint16)
type BaseStackOptionData ¶
type BaseStackOptionData struct { ClientLeg bool RemoteLeg bool Level StackOptionLevel Code StackOptionCode Data StackOptionData }
func (BaseStackOptionData) Len ¶
func (s BaseStackOptionData) Len() uint16
func (BaseStackOptionData) Marshal ¶
func (s BaseStackOptionData) Marshal() []byte
type CommandCode ¶
type CommandCode byte
CommandCode is SOCKS 6 request command code.
const ( CommandNoop CommandCode = iota CommandConnect CommandBind CommandUDPAssociate )
type HappyEyeballOptionData ¶
type HappyEyeballOptionData struct {
Availability bool
}
func (HappyEyeballOptionData) GetData ¶
func (t HappyEyeballOptionData) GetData() interface{}
func (HappyEyeballOptionData) Len ¶
func (t HappyEyeballOptionData) Len() uint16
func (HappyEyeballOptionData) Marshal ¶
func (t HappyEyeballOptionData) Marshal() []byte
func (*HappyEyeballOptionData) SetBool ¶
func (t *HappyEyeballOptionData) SetBool(b bool)
func (*HappyEyeballOptionData) SetData ¶
func (t *HappyEyeballOptionData) SetData(d interface{})
type IdempotenceAcceptedOptionData ¶
type IdempotenceAcceptedOptionData struct{}
func (IdempotenceAcceptedOptionData) Marshal ¶
func (s IdempotenceAcceptedOptionData) Marshal() []byte
type IdempotenceExpenditureOptionData ¶
type IdempotenceExpenditureOptionData struct {
Token uint32
}
func (IdempotenceExpenditureOptionData) Marshal ¶
func (s IdempotenceExpenditureOptionData) Marshal() []byte
type IdempotenceRejectedOptionData ¶
type IdempotenceRejectedOptionData struct{}
func (IdempotenceRejectedOptionData) Marshal ¶
func (s IdempotenceRejectedOptionData) Marshal() []byte
type IdempotenceWindowOptionData ¶
func (IdempotenceWindowOptionData) Marshal ¶
func (s IdempotenceWindowOptionData) Marshal() []byte
type MethodSelection ¶
type MethodSelection struct {
Method byte
}
func ParseMethodSelection5From ¶
func ParseMethodSelection5From(b io.Reader) (*MethodSelection, error)
func (*MethodSelection) Marshal5 ¶
func (h *MethodSelection) Marshal5() []byte
type MultipathOptionData ¶
type MultipathOptionData struct {
Availability bool
}
func (MultipathOptionData) GetData ¶
func (t MultipathOptionData) GetData() interface{}
func (MultipathOptionData) Len ¶
func (t MultipathOptionData) Len() uint16
func (MultipathOptionData) Marshal ¶
func (t MultipathOptionData) Marshal() []byte
func (*MultipathOptionData) SetBool ¶
func (t *MultipathOptionData) SetBool(b bool)
func (*MultipathOptionData) SetData ¶
func (t *MultipathOptionData) SetData(d interface{})
type NoFragmentationOptionData ¶
type NoFragmentationOptionData struct {
Availability bool
}
func (NoFragmentationOptionData) GetData ¶
func (t NoFragmentationOptionData) GetData() interface{}
func (NoFragmentationOptionData) Len ¶
func (t NoFragmentationOptionData) Len() uint16
func (NoFragmentationOptionData) Marshal ¶
func (t NoFragmentationOptionData) Marshal() []byte
func (*NoFragmentationOptionData) SetBool ¶
func (t *NoFragmentationOptionData) SetBool(b bool)
func (*NoFragmentationOptionData) SetData ¶
func (t *NoFragmentationOptionData) SetData(d interface{})
type OperationReply ¶
func NewOperationReply ¶
func NewOperationReply() *OperationReply
func NewOperationReplyWithCode ¶
func NewOperationReplyWithCode(code ReplyCode) *OperationReply
func ParseOperationReply5From ¶
func ParseOperationReply5From(b io.Reader) (*OperationReply, error)
func ParseOperationReplyFrom ¶
func ParseOperationReplyFrom(b io.Reader) (*OperationReply, error)
func (*OperationReply) Marshal ¶
func (o *OperationReply) Marshal() []byte
func (*OperationReply) Marshal5 ¶
func (o *OperationReply) Marshal5() []byte
type Option ¶
type Option struct { Kind OptionKind Length uint16 Data OptionData }
Option represent a SOCKS6 option.
func GetCombinedStackOptions ¶
func GetCombinedStackOptions(client StackOptionInfo, remote StackOptionInfo) []Option
func NewBacklogOption ¶
func NewIdempotenceAcceptedOption ¶
func NewIdempotenceAcceptedOption() Option
func NewIdempotenceRejectedOption ¶
func NewIdempotenceRejectedOption() Option
func NewPortParityOption ¶
func NewSessionIDOption ¶
func NewSessionInvalidOption ¶
func NewSessionInvalidOption() Option
func NewSessionOKOption ¶
func NewSessionOKOption() Option
func NewSessionRequestOption ¶
func NewSessionRequestOption() Option
func NewSessionTeardownOption ¶
func NewSessionTeardownOption() Option
func NewTOSOption ¶
func NewTTLOption ¶
func NewTokenRequestOption ¶
func NewUDPErrorOption ¶
func ParseOptionFrom ¶
ParseOptionFrom parses b as a SOCKS6 option.
type OptionData ¶
type OptionData interface {
Marshal() []byte
}
type OptionKind ¶
type OptionKind uint16
const ( OptionKindStack OptionKind OptionKindAuthenticationMethodAdvertisement OptionKindAuthenticationMethodSelection OptionKindAuthenticationData OptionKindSessionRequest OptionKindSessionID OptionKindSessionOK OptionKindSessionInvalid OptionKindSessionTeardown OptionKindTokenRequest OptionKindIdempotenceWindow OptionKindIdempotenceExpenditure OptionKindIdempotenceAccepted OptionKindIdempotenceRejected )
const OptionKindStreamID OptionKind = 0xfd10
type OptionSet ¶
type OptionSet struct {
// contains filtered or unexported fields
}
func NewOptionSet ¶
func NewOptionSet() *OptionSet
func (*OptionSet) GetData ¶
func (s *OptionSet) GetData(kind OptionKind) (OptionData, bool)
func (*OptionSet) GetDataF ¶
func (s *OptionSet) GetDataF(kind OptionKind, fn func(Option) bool) (OptionData, bool)
func (*OptionSet) GetKind ¶
func (s *OptionSet) GetKind(kind OptionKind) []Option
type PortParityOptionData ¶
func (PortParityOptionData) GetData ¶
func (t PortParityOptionData) GetData() interface{}
func (PortParityOptionData) Len ¶
func (t PortParityOptionData) Len() uint16
func (PortParityOptionData) Marshal ¶
func (t PortParityOptionData) Marshal() []byte
func (*PortParityOptionData) SetData ¶
func (t *PortParityOptionData) SetData(d interface{})
type RawOptionData ¶
type RawOptionData struct {
Data []byte
}
func (RawOptionData) GetData ¶
func (r RawOptionData) GetData() interface{}
func (RawOptionData) Len ¶
func (r RawOptionData) Len() uint16
func (*RawOptionData) Marshal ¶
func (r *RawOptionData) Marshal() []byte
func (*RawOptionData) SetData ¶
func (r *RawOptionData) SetData(d interface{})
type ReplyCode ¶
type ReplyCode byte
const ( OperationReplySuccess ReplyCode = iota OperationReplyServerFailure OperationReplyNotAllowedByRule OperationReplyNetworkUnreachable OperationReplyHostUnreachable OperationReplyConnectionRefused OperationReplyTTLExpired OperationReplyCommandNotSupported OperationReplyAddressNotSupported OperationReplyTimeout )
type Request ¶
type Request struct { CommandCode CommandCode Endpoint SocksAddr Options *OptionSet }
func NewRequest ¶
func NewRequest() *Request
type SessionIDOptionData ¶
type SessionIDOptionData struct {
ID []byte
}
func (SessionIDOptionData) Marshal ¶
func (s SessionIDOptionData) Marshal() []byte
type SessionInvalidOptionData ¶
type SessionInvalidOptionData struct{}
func (SessionInvalidOptionData) Marshal ¶
func (s SessionInvalidOptionData) Marshal() []byte
type SessionOKOptionData ¶
type SessionOKOptionData struct{}
func (SessionOKOptionData) Marshal ¶
func (s SessionOKOptionData) Marshal() []byte
type SessionRequestOptionData ¶
type SessionRequestOptionData struct{}
func (SessionRequestOptionData) Marshal ¶
func (s SessionRequestOptionData) Marshal() []byte
type SessionTeardownOptionData ¶
type SessionTeardownOptionData struct{}
func (SessionTeardownOptionData) Marshal ¶
func (s SessionTeardownOptionData) Marshal() []byte
type SocksAddr ¶
type SocksAddr struct {
// contains filtered or unexported fields
}
SocksAddr is address and port used in SOCKS6 protocol.
AddrIPv4Zero is 0.0.0.0:0 in SocksAddr format.
AddrIPv6Zero is [::]:0 in SocksAddr format.
var DefaultAddr SocksAddr = AddrIPv4Zero
DefaultAddr is 0.0.0.0:0 in SocksAddr format.
func AddrFromNetIPAddrPort ¶
func ConvertSocksAddr ¶
ConvertSocksAddr try to convert net.Addr to SocksAddr.
func MustParseAddr ¶
MustParseAddr parse address string to SocksAddr panic when error.
func ParseSocksAddr6From ¶
ParseSocksAddr6FromWithLimit parse socks 6 address with border set to 260 byte.
func ParseSocksAddr6FromWithLimit ¶
func ParseSocksAddr6FromWithLimit(b io.Reader, limit int) (address SocksAddr, padding byte, nConsume int, err error)
ParseSocksAddr6FromWithLimit parse socks 6 address with border check.
func (SocksAddr) AddressType ¶
func (a SocksAddr) AddressType() AddressType
type StackOptionCode ¶
type StackOptionCode byte
const ( // lv1. StackOptionCodeTOS StackOptionCode = 1 StackOptionCodeHappyEyeball StackOptionCode = 2 StackOptionCodeTTL StackOptionCode = 3 StackOptionCodeNoFragment StackOptionCode = 4 // lv4. StackOptionCodeTFO StackOptionCode = 1 StackOptionCodeMultipath StackOptionCode = 2 StackOptionCodeBacklog StackOptionCode = 3 StackOptionCodeUDPError StackOptionCode = 1 StackOptionCodePortParity StackOptionCode = 2 )
type StackOptionData ¶
type StackOptionData interface { OptionData Len() uint16 GetData() interface{} SetData(interface{}) }
type StackOptionInfo ¶
type StackOptionInfo map[int]interface{}
func GetStackOptionInfo ¶
func GetStackOptionInfo(ops *OptionSet, clientLeg bool) StackOptionInfo
func (*StackOptionInfo) Add ¶
func (s *StackOptionInfo) Add(d ...Option)
func (*StackOptionInfo) Combine ¶
func (s *StackOptionInfo) Combine(s2 StackOptionInfo)
func (StackOptionInfo) Filter ¶
func (s StackOptionInfo) Filter(s2 StackOptionInfo) StackOptionInfo
func (StackOptionInfo) GetOptions ¶
func (s StackOptionInfo) GetOptions(clientLeg bool, remoteLeg bool) []Option
type StackOptionLevel ¶
type StackOptionLevel byte
const ( StackOptionLevelIP StackOptionLevel StackOptionLevelIPv4 StackOptionLevelIPv6 StackOptionLevelTCP StackOptionLevelUDP )
type StreamIDOptionData ¶
type StreamIDOptionData struct {
ID uint32
}
func (StreamIDOptionData) Marshal ¶
func (s StreamIDOptionData) Marshal() []byte
type TFOOptionData ¶
type TFOOptionData struct {
PayloadSize uint16
}
func (TFOOptionData) GetData ¶
func (t TFOOptionData) GetData() interface{}
func (TFOOptionData) Len ¶
func (t TFOOptionData) Len() uint16
func (TFOOptionData) Marshal ¶
func (t TFOOptionData) Marshal() []byte
func (*TFOOptionData) SetData ¶
func (t *TFOOptionData) SetData(d interface{})
func (*TFOOptionData) SetUint16 ¶
func (t *TFOOptionData) SetUint16(b uint16)
type TOSOptionData ¶
type TOSOptionData struct {
TOS byte
}
func (TOSOptionData) GetData ¶
func (t TOSOptionData) GetData() interface{}
func (TOSOptionData) Len ¶
func (t TOSOptionData) Len() uint16
func (TOSOptionData) Marshal ¶
func (t TOSOptionData) Marshal() []byte
func (*TOSOptionData) SetData ¶
func (t *TOSOptionData) SetData(d interface{})
func (*TOSOptionData) SetUint8 ¶
func (t *TOSOptionData) SetUint8(b byte)
type TTLOptionData ¶
type TTLOptionData struct {
TTL byte
}
func (TTLOptionData) GetData ¶
func (t TTLOptionData) GetData() interface{}
func (TTLOptionData) Len ¶
func (t TTLOptionData) Len() uint16
func (TTLOptionData) Marshal ¶
func (t TTLOptionData) Marshal() []byte
func (*TTLOptionData) SetData ¶
func (t *TTLOptionData) SetData(d interface{})
func (*TTLOptionData) SetUint8 ¶
func (t *TTLOptionData) SetUint8(b byte)
type TokenRequestOptionData ¶
type TokenRequestOptionData struct {
WindowSize uint32
}
func (TokenRequestOptionData) Marshal ¶
func (s TokenRequestOptionData) Marshal() []byte
type UDPErrorOptionData ¶
type UDPErrorOptionData struct {
Availability bool
}
func (UDPErrorOptionData) GetData ¶
func (t UDPErrorOptionData) GetData() interface{}
func (UDPErrorOptionData) Len ¶
func (t UDPErrorOptionData) Len() uint16
func (UDPErrorOptionData) Marshal ¶
func (t UDPErrorOptionData) Marshal() []byte
func (*UDPErrorOptionData) SetBool ¶
func (t *UDPErrorOptionData) SetBool(b bool)
func (*UDPErrorOptionData) SetData ¶
func (t *UDPErrorOptionData) SetData(d interface{})
type UDPErrorType ¶
type UDPErrorType byte
const ( UDPErrorNetworkUnreachable UDPErrorType UDPErrorHostUnreachable UDPErrorTTLExpired UDPErrorDatagramTooBig )
type UDPHeaderType ¶
type UDPHeaderType byte
const ( UDPMessageAssociationInit UDPHeaderType UDPMessageAssociationAck UDPMessageDatagram UDPMessageError )
type UDPMessage ¶
type UDPMessage struct { Type UDPHeaderType AssociationID uint64 // dgram & icmp Endpoint SocksAddr // icmp ErrorEndpoint netip.Addr ErrorCode UDPErrorType // dgram Data []byte }
func ParseUDPMessage5From ¶
func ParseUDPMessage5From(b io.Reader) (*UDPMessage, error)
func ParseUDPMessageFrom ¶
func ParseUDPMessageFrom(b io.Reader) (*UDPMessage, error)
func (*UDPMessage) Marshal ¶
func (u *UDPMessage) Marshal() []byte
func (*UDPMessage) Marshal5 ¶
func (u *UDPMessage) Marshal5() []byte
type VersionMismatchError ¶
func (VersionMismatchError) Error ¶
func (e VersionMismatchError) Error() string
func (VersionMismatchError) Is ¶
func (e VersionMismatchError) Is(e2 error) bool
func (VersionMismatchError) Unwrap ¶
func (e VersionMismatchError) Unwrap() error