socks

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package socks provides a barebones SOCKSv5 server handshake protocol implementation according to RFC1928. https://datatracker.ietf.org/doc/html/rfc1928

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

View Source
var ErrFragment = errors.New("received UDP message is fragmented, fragmentation is not supported")

Functions

func ComposeUDP

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

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 DissectUDP

func DissectUDP(p []byte) (dstaddr Addr, data []byte, 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