socks

package
v0.0.0-...-bb933cf Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2018 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Method_NO_AUTH         = uint8(0x00)
	Method_GSSAPI          = uint8(0x01)
	Method_USER_PASS       = uint8(0x02)
	Method_IANA            = uint8(0x7F)
	Method_RESVERVE        = uint8(0x80)
	Method_NONE_ACCEPTABLE = uint8(0xFF)
	VERSION_V5             = uint8(0x05)
	CMD_CONNECT            = uint8(0x01)
	CMD_BIND               = uint8(0x02)
	CMD_ASSOCIATE          = uint8(0x03)
	ATYP_IPV4              = uint8(0x01)
	ATYP_DOMAIN            = uint8(0x03)
	ATYP_IPV6              = uint8(0x04)
	REP_SUCCESS            = uint8(0x00)
	REP_REQ_FAIL           = uint8(0x01)
	REP_RULE_FORBIDDEN     = uint8(0x02)
	REP_NETWOR_UNREACHABLE = uint8(0x03)
	REP_HOST_UNREACHABLE   = uint8(0x04)
	REP_CONNECTION_REFUSED = uint8(0x05)
	REP_TTL_TIMEOUT        = uint8(0x06)
	REP_CMD_UNSUPPORTED    = uint8(0x07)
	REP_ATYP_UNSUPPORTED   = uint8(0x08)
	REP_UNKNOWN            = uint8(0x09)
	RSV                    = uint8(0x00)
)

Variables

View Source
var (
	ZERO_IP   = []byte{0x00, 0x00, 0x00, 0x00}
	ZERO_PORT = []byte{0x00, 0x00}
)

Functions

This section is empty.

Types

type Auth

type Auth struct {
	User, Password string
}

type ClientConn

type ClientConn struct {
	UDPAddr string
	// contains filtered or unexported fields
}

func NewClientConn

func NewClientConn(conn *net.Conn, network, target string, timeout time.Duration, auth *Auth, header []byte) *ClientConn

SOCKS5 returns a Dialer that makes SOCKSv5 connections to the given address with an optional username and password. See RFC 1928 and RFC 1929. target must be a canonical address with a host and port. network : tcp udp

func (*ClientConn) Handshake

func (s *ClientConn) Handshake() error

connect takes an existing connection to a socks5 proxy server, and commands the server to extend that connection to target, which must be a canonical address with a host and port.

func (*ClientConn) SendUDP

func (s *ClientConn) SendUDP(data []byte, addr string) (respData []byte, err error)

type MethodsRequest

type MethodsRequest struct {
	// contains filtered or unexported fields
}

func NewMethodsRequest

func NewMethodsRequest(r io.ReadWriter, header ...[]byte) (s MethodsRequest, err interface{})

func (*MethodsRequest) Bytes

func (s *MethodsRequest) Bytes() []byte

func (*MethodsRequest) Methods

func (s *MethodsRequest) Methods() []uint8

func (*MethodsRequest) MethodsCount

func (s *MethodsRequest) MethodsCount() uint8

func (*MethodsRequest) Reply

func (s *MethodsRequest) Reply(method uint8) (err error)

func (*MethodsRequest) Select

func (s *MethodsRequest) Select(method uint8) bool

func (*MethodsRequest) Version

func (s *MethodsRequest) Version() uint8

type PacketUDP

type PacketUDP struct {
	// contains filtered or unexported fields
}

func NewPacketUDP

func NewPacketUDP() (p PacketUDP)

func (*PacketUDP) Build

func (p *PacketUDP) Build(destAddr string, data []byte) (err error)

func (*PacketUDP) Bytes

func (p *PacketUDP) Bytes() []byte

func (*PacketUDP) Data

func (p *PacketUDP) Data() []byte

func (*PacketUDP) Header

func (p *PacketUDP) Header() []byte

func (*PacketUDP) Host

func (p *PacketUDP) Host() string

func (*PacketUDP) Parse

func (p *PacketUDP) Parse(b []byte) (err error)

func (*PacketUDP) Port

func (p *PacketUDP) Port() string

type Request

type Request struct {
	// contains filtered or unexported fields
}

func NewRequest

func NewRequest(rw io.ReadWriter, header ...[]byte) (req Request, err interface{})

func (*Request) AType

func (s *Request) AType() uint8

func (*Request) Addr

func (s *Request) Addr() string

func (*Request) Bytes

func (s *Request) Bytes() []byte

func (*Request) CMD

func (s *Request) CMD() uint8

func (*Request) Host

func (s *Request) Host() string

func (*Request) NewReply

func (s *Request) NewReply(rep uint8, addr string) []byte

func (*Request) Port

func (s *Request) Port() string

func (*Request) TCPReply

func (s *Request) TCPReply(rep uint8) (err error)

func (*Request) UDPReply

func (s *Request) UDPReply(rep uint8, addr string) (err error)

type ServerConn

type ServerConn struct {
	UDPConnListener *net.UDPConn
	// contains filtered or unexported fields
}

func NewServerConn

func NewServerConn(conn *net.Conn, timeout time.Duration, auth *utils.BasicAuth, enableUDP bool, udpHost string, header []byte) *ServerConn

func (*ServerConn) AuthData

func (s *ServerConn) AuthData() Auth

func (*ServerConn) Close

func (s *ServerConn) Close()

func (*ServerConn) Handshake

func (s *ServerConn) Handshake() (err error)

func (*ServerConn) IsTCP

func (s *ServerConn) IsTCP() bool

func (*ServerConn) IsUDP

func (s *ServerConn) IsUDP() bool

func (*ServerConn) Method

func (s *ServerConn) Method() uint8

func (*ServerConn) Target

func (s *ServerConn) Target() string

type UDPPacket

type UDPPacket struct {
	// contains filtered or unexported fields
}

func ParseUDPPacket

func ParseUDPPacket(b []byte) (p UDPPacket, err error)

func (*UDPPacket) Data

func (s *UDPPacket) Data() []byte

func (*UDPPacket) Header

func (s *UDPPacket) Header() []byte

func (*UDPPacket) Host

func (s *UDPPacket) Host() string

func (*UDPPacket) NewReply

func (s *UDPPacket) NewReply(data []byte) []byte

func (*UDPPacket) Port

func (s *UDPPacket) Port() string

Jump to

Keyboard shortcuts

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