socks5

package
v0.0.0-...-8293206 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SOCKS5_METHOD_NO_AUTH byte = iota
	SOCKS5_METHOD_GSSAPI
	SOCKS5_METHOD_USER_PASSWORD
	SOCKS5_METHOD_NOT_SUPPORT
)
View Source
const (
	SOCKS5_ATYPE_IPV4 byte

	SOCKS5_ATYPE_DOMAIN
	SOCKS5_ATYPE_IPV6
)
View Source
const (
	SOCKS5_CMD_CONNECT byte
	SOCKS5_CMD_BIND
	SOCKS5_CMD_UDP_FORWARD
)
View Source
const (
	SOCKS5_REP_SUCCESS byte = iota
	SOCKS5_REP_CONNECTION_FAILED
	SOCKS5_REP_NOT_ALLOWED
	SOCKS5_REP_NETWORK_UNREACHABLE
	SOCKS5_REP_HOST_UNREACHABLE
	SOCKS5_REP_CONNECTION_REFUSED
	SOCKS5_REP_TTL_TIMEOUT
	SOCKS5_REP_UNSUPPORTED_COMMAND
	SOCKS5_REP_UNSUPPORTED_ATYPE
)
View Source
const (
	SOCKS5_VERSION byte = 0x05
)

Variables

View Source
var ErrRemoteNotAllowed = errors.New("request host not allowed")
View Source
var ErrSocks5CommandNotSupported = errors.New("Socks5 command not supported")
View Source
var ErrSocks5MethodNotSupported = errors.New("Socks5 method not supported")
View Source
var ErrSocks5VersionNotSupported = errors.New("Socks5 version not supported")
View Source
var FillRequestMessage = fillRequestMessage
View Source
var IsDomain = isDomain

Functions

This section is empty.

Types

type Client

type Client struct {
	Address  string
	Port     int
	Timeout  time.Duration
	User     string
	Password string
	net.Conn
}

func (*Client) Connect

func (c *Client) Connect(addr string, port int) error

type ProxyConn

type ProxyConn interface {
	Proxy(client net.Conn)
}

type Server

type Server struct {
	Address string
	Port    int
	OnError func(error)

	OnClientRequest func(rm *Socks5_RequestMessage) error
	OnConnectRemote func(host string, port int) (ProxyConn, error)
	// contains filtered or unexported fields
}

func (*Server) Listen

func (s *Server) Listen() error

type Socks5_RequestMessage

type Socks5_RequestMessage struct {
	Ver   byte
	Cmd   byte
	Rsv   byte
	Atype byte
	// contains filtered or unexported fields
}

func (*Socks5_RequestMessage) GetHost

func (rm *Socks5_RequestMessage) GetHost() string

func (*Socks5_RequestMessage) GetPort

func (rm *Socks5_RequestMessage) GetPort() int

func (*Socks5_RequestMessage) GetSize

func (rm *Socks5_RequestMessage) GetSize() int

type Socks5_ResponseMessage

type Socks5_ResponseMessage struct {
	Ver   byte
	Rep   byte
	Rsv   byte
	Atype byte
	// contains filtered or unexported fields
}

func (*Socks5_ResponseMessage) GetSize

func (rm *Socks5_ResponseMessage) GetSize() int

type Socks5_SelectionMessage

type Socks5_SelectionMessage struct {
	Ver    byte
	Method byte
}

type Socks5_UserPassVerify

type Socks5_UserPassVerify struct {
	ProtocolVersion byte
}

type Socks5_VersionMessage

type Socks5_VersionMessage struct {
	Ver       byte
	NumMethod byte
	// contains filtered or unexported fields
}

func (*Socks5_VersionMessage) GetSize

func (vm *Socks5_VersionMessage) GetSize() int

Jump to

Keyboard shortcuts

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