socks5

package module
v2.0.0-...-8459ecb Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedProtocol    = errors.New("unsupported protocol")
	ErrUnsupportedCommand     = errors.New("unsupported command")
	ErrUnsupportedAddressType = errors.New("unsupported address type")
	ErrNoAcceptableAuth       = errors.New("no acceptable auth method")
)

Errors

Functions

This section is empty.

Types

type AuthMethod

type AuthMethod uint8
const (
	AuthNone AuthMethod = iota
	AuthGSSAPI
	AuthUserPass
	AuthChallengeHandshake

	AuthChallengeResponse
	AuthSSL
	AuthNDS
	AuthMultiAuthFramework
	AuthJSON
	AuthN

	AuthNoAcceptable AuthMethod = 0xff
)

Auth Methods

type Auther

type Auther interface {
	Auth(ctx context.Context, meth AuthMethod, c net.Conn) error
}

type AutherFunc

type AutherFunc func(ctx context.Context, meth AuthMethod, c net.Conn) error

func (AutherFunc) Auth

func (f AutherFunc) Auth(ctx context.Context, meth AuthMethod, c net.Conn) error

type Command

type Command uint8

Command is request command or reply code.

const (
	CommandTCPConn  Command = 0x01
	CommandTCPBind  Command = 0x02
	CommandUDPAssoc Command = 0x03
)

Commands

func (Command) String

func (c Command) String() string

type Dialer

type Dialer struct {
	Dialer interface {
		DialContext(ctx context.Context, nw, addr string) (net.Conn, error)
	}

	Proxy string

	AuthMethods []AuthMethod // in order of preference
	Auther      Auther
}

func (*Dialer) DialContext

func (d *Dialer) DialContext(ctx context.Context, nw, addr string) (_ net.Conn, err error)

type DialerFunc

type DialerFunc func(ctx context.Context, nw, addr string) (net.Conn, error)

func (DialerFunc) DialContext

func (f DialerFunc) DialContext(ctx context.Context, nw, addr string) (net.Conn, error)

type Proto

type Proto struct{}

func (Proto) ClientHandshake

func (p Proto) ClientHandshake(c net.Conn, methods ...AuthMethod) (auth AuthMethod, err error)

func (Proto) ReadReply

func (p Proto) ReadReply(c net.Conn, cmd Command) (Reply, net.Addr, error)

func (Proto) ReadRequest

func (p Proto) ReadRequest(c net.Conn) (Command, net.Addr, error)

func (Proto) ServerHandshake

func (p Proto) ServerHandshake(c net.Conn, methods ...AuthMethod) (auth AuthMethod, err error)

func (Proto) WriteReply

func (p Proto) WriteReply(c net.Conn, rep Reply, addr net.Addr) (err error)

func (Proto) WriteRequest

func (p Proto) WriteRequest(c net.Conn, cmd Command, addr net.Addr) (err error)

type Reply

type Reply Command
const (
	ReplySuccess Reply = iota
	ReplyGeneralFailure
	ReplyNotAllowed
	ReplyNetworkUnreachable
	ReplyHostUnreachable
	ReplyConnRefused
	ReplyTTLExpired
	ReplyCommandNotSupported
	ReplyAddressTypeNotSupported
)

Reply Codes

func (Reply) Error

func (r Reply) Error() string

func (Reply) String

func (r Reply) String() string

type TCPAddr

type TCPAddr string

TCPAddr is a string address.

func (TCPAddr) Network

func (a TCPAddr) Network() string

func (TCPAddr) String

func (a TCPAddr) String() string

type UDPAddr

type UDPAddr string

UDPAddr is a string address.

func (UDPAddr) Network

func (a UDPAddr) Network() string

func (UDPAddr) String

func (a UDPAddr) String() string

type UDPConn

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

func (UDPConn) Close

func (c UDPConn) Close() (err error)

func (UDPConn) LocalAddr

func (c UDPConn) LocalAddr() net.Addr

func (UDPConn) Read

func (c UDPConn) Read(p []byte) (n int, err error)

func (UDPConn) ReadFrom

func (c UDPConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)

func (UDPConn) RemoteAddr

func (c UDPConn) RemoteAddr() net.Addr

func (UDPConn) SetDeadline

func (c UDPConn) SetDeadline(t time.Time) error

func (UDPConn) SetReadDeadline

func (c UDPConn) SetReadDeadline(t time.Time) error

func (UDPConn) SetWriteDeadline

func (c UDPConn) SetWriteDeadline(t time.Time) error

func (UDPConn) Write

func (c UDPConn) Write(p []byte) (n int, err error)

func (UDPConn) WriteTo

func (c UDPConn) WriteTo(p []byte, addr net.Addr) (n int, err error)

type UserPassAuth

type UserPassAuth struct{}

func (UserPassAuth) ReadReply

func (a UserPassAuth) ReadReply(c net.Conn) (status int, err error)

func (UserPassAuth) ReadRequest

func (a UserPassAuth) ReadRequest(c net.Conn) (usr, pwd string, err error)

func (UserPassAuth) WriteReply

func (a UserPassAuth) WriteReply(c net.Conn, status int) (err error)

func (UserPassAuth) WriteRequest

func (a UserPassAuth) WriteRequest(c net.Conn, usr, pwd string) (err error)

Jump to

Keyboard shortcuts

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