socks

package
v0.0.0-...-88fee7f Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2019 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

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

根据 RFC 1928 section 4 支持的 cmd

View Source
const (
	AtypIPv4       = 1
	AtypDomainName = 3
	AtypIPv6       = 4
)

根据 RFC 1928 section 5 支持的 addr

View Source
const (
	ErrGeneralFailure       = Error(1)
	ErrConnectionNotAllowed = Error(2)
	ErrNetworkUnreachable   = Error(3)
	ErrHostUnreachable      = Error(4)
	ErrConnectionRefused    = Error(5)
	ErrTTLExpired           = Error(6)
	ErrCommandNotSupported  = Error(7)
	ErrAddressNotSupported  = Error(8)
	InfoUDPAssociate        = Error(9)
)

根据 RFC 1928 section 6 定义错误类型

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

MaxAddrLen 是根据 RFC 1928定义请求和响应的结构大小

Variables

This section is empty.

Functions

This section is empty.

Types

type Addr

type Addr []byte

Addr表示RFC 1928第5节中定义的SOCKS地址

func Handshake

func Handshake(rw io.ReadWriter) (Addr, error)

Handshake 快速初始化,直接返回需要连接的地址

func ReadAddr

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

从连接中直接获取 address

func (Addr) String

func (a Addr) String() string

type Error

type Error byte

Error represents a SOCKS error

func (Error) Error

func (err Error) Error() string

Jump to

Keyboard shortcuts

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