socks5

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const VersionCode = 0x05

Variables

View Source
var (
	ErrTooManyAuthMethods   = errors.New("too many auth methods")
	ErrHostnameTooLong      = errors.New("hostname too long")
	ErrInvalidVersion       = errors.New("invalid version")
	ErrInvalidAddrType      = errors.New("invalid address type")
	ErrNonZeroReservedField = errors.New("reserved field has a non-zero value")
)

Functions

This section is empty.

Types

type AuthMethod

type AuthMethod byte
const (
	AuthNone AuthMethod = 0x00

	AuthNotAcceptable AuthMethod = 0xff
)

func (AuthMethod) MarshalText

func (m AuthMethod) MarshalText() ([]byte, error)

func (AuthMethod) String

func (m AuthMethod) String() string

type Command

type Command byte
const (
	CommandConnect      Command = 0x01
	CommandBind         Command = 0x02
	CommandAssociateUDP Command = 0x03
)

func (Command) MarshalText

func (c Command) MarshalText() ([]byte, error)

func (Command) String

func (c Command) String() string

type Greeting

type Greeting struct {
	AuthMethods []AuthMethod
}

func ReadGreeting

func ReadGreeting(r *bufio.Reader) (*Greeting, error)

func (*Greeting) Write

func (g *Greeting) Write(w io.Writer) error

type GreetingReply

type GreetingReply struct {
	AuthMethod AuthMethod
}

func ReadGreetingReply

func ReadGreetingReply(r *bufio.Reader) (*GreetingReply, error)

func (*GreetingReply) Write

func (r *GreetingReply) Write(w io.Writer) error

type Reply

type Reply struct {
	Status   Status
	BindAddr addr.Addr
}

func ReadReply

func ReadReply(r *bufio.Reader) (*Reply, error)

func (*Reply) Write

func (r *Reply) Write(w io.Writer) error

type Request

type Request struct {
	Command Command
	DstAddr addr.Addr
}

func ReadRequest

func ReadRequest(r *bufio.Reader) (*Request, error)

func (*Request) Write

func (r *Request) Write(w io.Writer) error

type Status

type Status byte
const (
	StatusOK                   Status = 0x00
	StatusGeneralFailure       Status = 0x01
	StatusConnectionNotAllowed Status = 0x02
	StatusNetworkUnreachable   Status = 0x03
	StatusHostUnreachable      Status = 0x04
	StatusConnectionRefused    Status = 0x05
	StatusTTLExpired           Status = 0x06
	StatusCommandNotSupported  Status = 0x07
	StatusAddrTypeNotSupported Status = 0x08
)

func (Status) MarshalText

func (s Status) MarshalText() ([]byte, error)

func (Status) String

func (s Status) String() string

Jump to

Keyboard shortcuts

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