socks

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package socks provides a barebones SOCKSv5 server handshake protocol implementation.

Index

Constants

View Source
const (
	SOCKSv5 = 0x05

	CONNECT   = 0x01
	BIND      = 0x02
	UDP_ASSOC = 0x03

	ADDR_IPV4 = 0x01
	ADDR_FQDN = 0x03
	ADDR_IPV6 = 0x04

	RSV = 0x00
)

Variables

This section is empty.

Functions

func ComposeUDP

func ComposeUDP(srcaddr, dstaddr Addr, p []byte) (r []byte, err error)

func DissectUDP

func DissectUDP(p []byte) (srcaddr Addr, dstaddr Addr, data []byte)

func Handshake

func Handshake(c net.Conn) (cmd byte, address string, err error)

func WriteStatus

func WriteStatus(c net.Conn, status SocksStatus, addr Addr) (int, error)

Types

type Addr

type Addr []byte

func AddrAddr

func AddrAddr(orig net.Addr) (r Addr)

func AddrIPPort

func AddrIPPort(ip net.IP, port int) (r Addr)

func AddrString

func AddrString(addr string) (r Addr, err error)

func (Addr) IPPort

func (t Addr) IPPort() (ip net.IP, port int)

func (Addr) String

func (t Addr) String() string

type SocksStatus

type SocksStatus byte
const (
	StatusOK SocksStatus = iota
	StatusGeneralFailure
	StatusNotAllowed
	StatusNetworkUnreachable
	StatusHostUnreachable
	StatusConnRefused
	StatusTTLExpired
	StatusCommandNotSupported
	StatusAddressNotSupported
)

func (SocksStatus) Error

func (e SocksStatus) Error() string

Jump to

Keyboard shortcuts

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