socks5

package module
v0.0.0-...-cd343ff Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version5 = 0x05

	MethodNoAuth              = 0x00
	MethodGSSAPI              = 0x01
	MethodUserPass            = 0x02
	MethodNoAcceptableMethods = 0xFF

	CommandConnect      = 0x01
	CommandBind         = 0x02
	CommandUDPAssociate = 0x03

	AddrTypeIPv4       = 0x01
	AddrTypeDomainName = 0x03
	AddrTypeIPv6       = 0x04
	AddrLenIPv4        = 4
	AddrLenIPv6        = 16

	ReplySucceed                   = 0x00
	ReplyGeneralSocksServerFailure = 0x01
	ReplyConnectionNowAllowed      = 0x02
	ReplyNetworkUnreachable        = 0x03
	ReplyHostUnreachable           = 0x04
	ReplyConnectionRefused         = 0x05
	ReplyTTLExpired                = 0x06
	ReplyCommandNotSupported       = 0x07
	ReplyAddressTypeNotSupported   = 0x08
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(options ClientOptions) *Client

func (*Client) UDPAssociate

func (c *Client) UDPAssociate(localAddr *net.UDPAddr) (net.PacketConn, error)

type ClientOptions

type ClientOptions struct {
	Addr string
}

type MethodSelectionRequestHeader

type MethodSelectionRequestHeader struct {
	Version  byte
	NMethods byte
}

type MethodSelectionResponse

type MethodSelectionResponse struct {
	Version byte
	Method  byte
}

type Reply

type Reply struct {
	Version  byte
	Reply    byte
	Reserved byte
	AddrType byte
	BindAddr [4]byte
	BindPort uint16
}

type Request

type Request struct {
	Version  byte
	Command  byte
	Reserved byte
	AddrType byte
	DstAddr  [4]byte
	DstPort  uint16
}

type UDPAssociateConn

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

func NewUDPAssociateConn

func NewUDPAssociateConn(proxyAddr string, localAddr *net.UDPAddr) *UDPAssociateConn

func (*UDPAssociateConn) Close

func (u *UDPAssociateConn) Close() error

Close implements net.Conn.

func (*UDPAssociateConn) LocalAddr

func (u *UDPAssociateConn) LocalAddr() net.Addr

LocalAddr implements net.Conn.

func (*UDPAssociateConn) ReadFrom

func (u *UDPAssociateConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)

ReadFrom implements net.PacketConn.

func (*UDPAssociateConn) RemoteAddr

func (u *UDPAssociateConn) RemoteAddr() net.Addr

RemoteAddr implements net.Conn.

func (*UDPAssociateConn) SetDeadline

func (u *UDPAssociateConn) SetDeadline(t time.Time) error

SetDeadline implements net.Conn.

func (*UDPAssociateConn) SetReadDeadline

func (u *UDPAssociateConn) SetReadDeadline(t time.Time) error

SetReadDeadline implements net.Conn.

func (*UDPAssociateConn) SetWriteDeadline

func (u *UDPAssociateConn) SetWriteDeadline(t time.Time) error

SetWriteDeadline implements net.Conn.

func (*UDPAssociateConn) WriteTo

func (u *UDPAssociateConn) WriteTo(p []byte, addr net.Addr) (n int, err error)

WriteTo implements net.PacketConn.

type UDPRequestHeader

type UDPRequestHeader struct {
	Reserved [2]byte
	Fragment byte
	AddrType byte
	DstAddr  [4]byte
	DstPort  uint16
}

Jump to

Keyboard shortcuts

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