socks

package
v0.0.0-...-5f1f6bc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthNone     = 0
	AuthPassword = 2
)

SOCKS auth type

View Source
const (
	CmdError        byte = 0
	CmdConnect      byte = 1
	CmdBind         byte = 2
	CmdUDPAssociate byte = 3
)

SOCKS request commands as defined in RFC 1928 section 4

View Source
const (
	ATypIP4    = 1
	ATypDomain = 3
	ATypIP6    = 4
)

SOCKS address types as defined in RFC 1928 section 5

View Source
const MaxAddrLen = 1 + 1 + 255 + 2

MaxAddrLen is the maximum size of SOCKS address in bytes

Variables

View Source
var Command = []string{
	"Error",
	"Connect",
	"Bind",
	"UDPAssociate",
}
View Source
var Errors = []error{
	errors.New(""),
	errors.New("general failure"),
	errors.New("connection forbidden"),
	errors.New("network unreachable"),
	errors.New("host unreachable"),
	errors.New("connection refused"),
	errors.New("TTL expired"),
	errors.New("command not supported"),
	errors.New("address type not supported"),
	errors.New("socks5UDPAssociate"),
}

Errors are socks5 errors

Functions

This section is empty.

Types

type Addr

type Addr []byte

Addr represents a SOCKS address as defined in RFC 1928 section 5.

func ParseAddr

func ParseAddr(s string) (Addr, error)

ParseAddr parses the address in string s. Returns nil if failed.

func ReadAddr

func ReadAddr(r io.Reader) (Addr, error)

ReadAddr reads just enough bytes from r to get a valid Addr.

func SplitAddr

func SplitAddr(b []byte) Addr

SplitAddr slices a SOCKS address from beginning of b. Returns nil if failed.

func (Addr) Network

func (a Addr) Network() string

Network returns network name. Implements netip.AddrPort interface.

func (Addr) String

func (a Addr) String() string

String serializes SOCKS address a to string form.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL