gosocks4

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: MIT Imports: 7 Imported by: 1 module, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

gosocks4

golang and SOCKS4(a)

Documentation

Overview

SOCKS Protocol Version 4(a) https://www.openssh.com/txt/socks4.protocol https://www.openssh.com/txt/socks4a.protocol

Index

Constants

View Source
const (
	CmdConnect uint8 = 1
	CmdBind          = 2
)
View Source
const (
	AddrIPv4   = 0
	AddrDomain = 1
)
View Source
const (
	Granted        = 90
	Failed         = 91
	Rejected       = 92
	RejectedUserid = 93
)
View Source
const (
	Ver4 = 4
)

Variables

View Source
var (
	ErrBadVersion      = errors.New("Bad version")
	ErrBadFormat       = errors.New("Bad format")
	ErrBadAddrType     = errors.New("Bad address type")
	ErrShortDataLength = errors.New("Short data length")
	ErrBadCmd          = errors.New("Bad Command")
)

Functions

This section is empty.

Types

type Addr

type Addr struct {
	Type int
	Host string
	Port uint16
}

func (*Addr) Decode

func (addr *Addr) Decode(b []byte) error

func (*Addr) Encode

func (addr *Addr) Encode(b []byte) error

func (*Addr) String

func (addr *Addr) String() string

type Reply

type Reply struct {
	Code uint8
	Addr *Addr
}

+----+----+----+----+----+----+----+----+ | VN | CD | DSTPORT | DSTIP | +----+----+----+----+----+----+----+----+

1    1      2              4

func NewReply

func NewReply(code uint8, addr *Addr) *Reply

func ReadReply

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

func (*Reply) String

func (r *Reply) String() string

func (*Reply) Write

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

type Request

type Request struct {
	Cmd    uint8
	Addr   *Addr
	Userid []byte
}

+----+----+----+----+----+----+----+----+----+----+....+----+ | VN | CD | DSTPORT | DSTIP | USERID |NULL| +----+----+----+----+----+----+----+----+----+----+....+----+

1    1      2              4           variable       1

func NewRequest

func NewRequest(cmd uint8, addr *Addr, userid []byte) *Request

func ReadRequest

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

func (*Request) String

func (r *Request) String() string

func (*Request) Write

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

Jump to

Keyboard shortcuts

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