socks

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2019 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthNone     = 0
	AuthPassword = 2
)

SOCKS auth type

View Source
const (
	CmdConnect      = 1
	CmdBind         = 2
	CmdUDPAssociate = 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 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

func ATYP

func ATYP(b byte) int

ATYP returns the address type

func UoT

func UoT(b byte) bool

UoT returns whether it is udp over tcp

Types

type Addr

type Addr []byte

Addr .

func ParseAddr

func ParseAddr(s string) Addr

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 ReadAddrBuf

func ReadAddrBuf(r io.Reader, b []byte) (Addr, error)

ReadAddrBuf 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) 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