gosocks4

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2018 License: MIT Imports: 7 Imported by: 37

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