Documentation ¶
Overview ¶
SOCKS Protocol Version 5 http://tools.ietf.org/html/rfc1928 http://tools.ietf.org/html/rfc1929
Index ¶
- Constants
- Variables
- func ReadMethods(r io.Reader) ([]uint8, error)
- func WriteMethod(method uint8, w io.Writer) error
- type Addr
- func (addr *Addr) Decode(b []byte) error
- func (addr *Addr) Encode(b []byte) (int, error)
- func (addr *Addr) Length() (n int)
- func (addr *Addr) ParseFrom(saddr string) error
- func (addr *Addr) ReadFrom(r io.Reader) (n int64, err error)
- func (addr *Addr) String() string
- func (addr *Addr) WriteTo(w io.Writer) (int64, error)
- type Conn
- func (conn *Conn) Close() error
- func (conn *Conn) Handleshake() error
- func (conn *Conn) ID() string
- func (conn *Conn) LocalAddr() net.Addr
- func (conn *Conn) Read(b []byte) (n int, err error)
- func (conn *Conn) RemoteAddr() net.Addr
- func (conn *Conn) SetDeadline(t time.Time) error
- func (conn *Conn) SetReadDeadline(t time.Time) error
- func (conn *Conn) SetWriteDeadline(t time.Time) error
- func (conn *Conn) Write(b []byte) (n int, err error)
- type Reply
- type Request
- type Selector
- type UDPDatagram
- type UDPHeader
- type UserPassRequest
- type UserPassResponse
Constants ¶
View Source
const ( Ver5 = 5 UserPassVer = 1 )
View Source
const ( MethodNoAuth uint8 = iota MethodGSSAPI MethodUserPass // X'03' to X'7F' IANA ASSIGNED // X'80' to X'FE' RESERVED FOR PRIVATE METHODS MethodNoAcceptable = 0xFF )
View Source
const ( CmdConnect uint8 = 1 CmdBind uint8 = 2 CmdUdp uint8 = 3 )
View Source
const ( AddrIPv4 uint8 = 1 AddrDomain uint8 = 3 AddrIPv6 uint8 = 4 )
View Source
const ( Succeeded uint8 = iota Failure NotAllowed NetUnreachable HostUnreachable ConnRefused TTLExpired CmdUnsupported AddrUnsupported )
Variables ¶
Functions ¶
func ReadMethods ¶
Method selection
+----+----------+----------+ |VER | NMETHODS | METHODS | +----+----------+----------+ | 1 | 1 | 1 to 255 | +----+----------+----------+
Types ¶
type Addr ¶
Address
+------+----------+----------+ | ATYP | ADDR | PORT | +------+----------+----------+ | 1 | Variable | 2 | +------+----------+----------+
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
func (*Conn) Handleshake ¶
func (*Conn) RemoteAddr ¶
type Reply ¶
The SOCKSv5 reply
+----+-----+-------+------+----------+----------+ |VER | REP | RSV | ATYP | BND.ADDR | BND.PORT | +----+-----+-------+------+----------+----------+ | 1 | 1 | X'00' | 1 | Variable | 2 | +----+-----+-------+------+----------+----------+
type Request ¶
The SOCKSv5 request
+----+-----+-------+------+----------+----------+ |VER | CMD | RSV | ATYP | DST.ADDR | DST.PORT | +----+-----+-------+------+----------+----------+ | 1 | 1 | X'00' | 1 | Variable | 2 | +----+-----+-------+------+----------+----------+
func NewRequest ¶
type UDPDatagram ¶
func NewUDPDatagram ¶
func NewUDPDatagram(header *UDPHeader, data []byte) *UDPDatagram
type UDPHeader ¶
UDP request
+----+------+------+----------+----------+----------+ |RSV | FRAG | ATYP | DST.ADDR | DST.PORT | DATA | +----+------+------+----------+----------+----------+ | 2 | 1 | 1 | Variable | 2 | Variable | +----+------+------+----------+----------+----------+
type UserPassRequest ¶
Username/Password authentication request
+----+------+----------+------+----------+ |VER | ULEN | UNAME | PLEN | PASSWD | +----+------+----------+------+----------+ | 1 | 1 | 1 to 255 | 1 | 1 to 255 | +----+------+----------+------+----------+
func NewUserPassRequest ¶
func NewUserPassRequest(ver byte, u, p string) *UserPassRequest
func ReadUserPassRequest ¶
func ReadUserPassRequest(r io.Reader) (*UserPassRequest, error)
func (*UserPassRequest) String ¶
func (req *UserPassRequest) String() string
type UserPassResponse ¶
Username/Password authentication response
+----+--------+ |VER | STATUS | +----+--------+ | 1 | 1 | +----+--------+
func NewUserPassResponse ¶
func NewUserPassResponse(ver, status byte) *UserPassResponse
func ReadUserPassResponse ¶
func ReadUserPassResponse(r io.Reader) (*UserPassResponse, error)
func (*UserPassResponse) String ¶
func (res *UserPassResponse) String() string
Click to show internal directories.
Click to hide internal directories.