socks5

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version byte = 5

	AuthTypeNotRequired       byte = 0x00
	AuthTypeGSSAPI            byte = 0x01
	AuthTypeUsernamePassword  byte = 0x02
	AuthTypeNoAcceptedMethods byte = 0xFF

	UsernamePasswordStatusSuccess byte = 0x00
	UsernamePasswordStatusFailure byte = 0x01

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

	ReplyCodeSuccess                byte = 0
	ReplyCodeFailure                byte = 1
	ReplyCodeNotAllowed             byte = 2
	ReplyCodeNetworkUnreachable     byte = 3
	ReplyCodeHostUnreachable        byte = 4
	ReplyCodeConnectionRefused      byte = 5
	ReplyCodeTTLExpired             byte = 6
	ReplyCodeUnsupported            byte = 7
	ReplyCodeAddressTypeUnsupported byte = 8
)

Variables

This section is empty.

Functions

func NewDialer

func NewDialer(dialer common.Dialer, options Options) (common.Dialer, error)

Types

type AssociatePacketConn

type AssociatePacketConn struct {
	net.Conn
	// contains filtered or unexported fields
}

func (*AssociatePacketConn) Close

func (c *AssociatePacketConn) Close() error

func (*AssociatePacketConn) Read

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

func (*AssociatePacketConn) ReadFrom

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

func (*AssociatePacketConn) RemoteAddr

func (c *AssociatePacketConn) RemoteAddr() net.Addr

func (*AssociatePacketConn) SetReadBuffer

func (c *AssociatePacketConn) SetReadBuffer(n int) error

QUIC

func (*AssociatePacketConn) SetWriteBuffer

func (c *AssociatePacketConn) SetWriteBuffer(n int) error

QUIC

func (*AssociatePacketConn) SyscallConn

func (c *AssociatePacketConn) SyscallConn() (syscall.RawConn, error)

QUIC

func (*AssociatePacketConn) Write

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

func (*AssociatePacketConn) WriteTo

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

type AuthRequest

type AuthRequest struct {
	Methods []byte
}

func (*AuthRequest) WriteRequest

func (r *AuthRequest) WriteRequest(writer io.Writer) error

type AuthResponse

type AuthResponse struct {
	Method byte
}

func (*AuthResponse) ReadResponse

func (r *AuthResponse) ReadResponse(reader io.Reader) error

type CommandRequest

type CommandRequest struct {
	Command     byte
	Destination common.SocksAddr
}

func (*CommandRequest) WriteRequest

func (r *CommandRequest) WriteRequest(writer io.Writer) error

type CommandResponse

type CommandResponse struct {
	ReplyCode byte
	Bind      common.SocksAddr
}

func (*CommandResponse) ReadResponse

func (r *CommandResponse) ReadResponse(reader io.Reader) error

type Dialer

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

func (*Dialer) DialContext

func (d *Dialer) DialContext(ctx context.Context, network string, address common.SocksAddr) (conn net.Conn, err error)

func (*Dialer) ListenPacket

func (d *Dialer) ListenPacket(ctx context.Context, address common.SocksAddr) (net.PacketConn, error)

type Options

type Options struct {
	Address  netip.AddrPort `yaml:"address,omitempty"`
	Username string         `yaml:"username,omitempty"`
	Password string         `yaml:"password,omitempty"`
}

type UsernamePasswordAuthRequest

type UsernamePasswordAuthRequest struct {
	Username string
	Password string
}

func (*UsernamePasswordAuthRequest) WriteRequest

func (r *UsernamePasswordAuthRequest) WriteRequest(writer io.Writer) error

type UsernamePasswordAuthResponse

type UsernamePasswordAuthResponse struct {
	Status byte
}

func (*UsernamePasswordAuthResponse) ReadResponse

func (r *UsernamePasswordAuthResponse) ReadResponse(reader io.Reader) error

Jump to

Keyboard shortcuts

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