Documentation ¶
Overview ¶
Package socks5 provides SOCKS5 client functionalities.
Index ¶
- Constants
- func EncodeUDPPacket(addr Addr, payload []byte) (packet []byte, err error)
- type Addr
- func ClientHandshake(rw io.ReadWriter, addr Addr, command Command, user *User) (Addr, error)
- func DecodeUDPPacket(packet []byte) (addr Addr, payload []byte, err error)
- func ParseAddr(addr net.Addr) Addr
- func ParseAddrString(s string) Addr
- func ReadAddr(r io.Reader, b []byte) (Addr, error)
- func SerializeAddr(domainName string, dstIP net.IP, dstPort uint16) Addr
- func SplitAddr(b []byte) Addr
- type Atyp
- type AuthMethod
- type Command
- type Reply
- type User
Constants ¶
const MaxAddrLen = 1 + 1 + 255 + 2
MaxAddrLen is the maximum size of SOCKS address in bytes.
const MaxAuthLen = 255
MaxAuthLen is the maximum size of user/password field in SOCKS auth.
const Version = 0x05
Version is the protocol version as defined in RFC 1928 section 4.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Addr ¶
type Addr []byte
Addr represents a SOCKS address as defined in RFC 1928 section 5.
func ClientHandshake ¶
ClientHandshake fast-tracks SOCKS initialization to get target address to connect on client side.
func DecodeUDPPacket ¶
DecodeUDPPacket split `packet` to addr payload, and this function is mutable with `packet`
func ParseAddr ¶
ParseAddr parses a socks addr from net.Addr. This is a fast path of ParseAddrString(addr.String())
func ParseAddrString ¶
ParseAddrString parses the address in string s to Addr. Returns nil if failed.
func SerializeAddr ¶
SerializeAddr serializes destination address and port to Addr. If a domain name is provided, AtypDomainName would be used first.
type AuthMethod ¶
type AuthMethod = uint8
AuthMethod is the authentication method as defined in RFC 1928 section 3.
const ( MethodNoAuth AuthMethod = 0x00 MethodUserPass AuthMethod = 0x02 )
SOCKS authentication methods as defined in RFC 1928 section 3.
type Command ¶
type Command uint8
Command is request commands as defined in RFC 1928 section 4.
SOCKS request commands as defined in RFC 1928 section 4.