proxy

package module
v0.0.0-...-25b56d9 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2018 License: MIT Imports: 10 Imported by: 0

README

Socks

This golang package implements the SOCKS protocol as defined in RFC1928. I wrote this sometime in 2017.

License

This project is licensed under the MIT License.

Documentation

Index

Constants

View Source
const (
	IPv4       byte = 0x01
	DomainName byte = 0x03
	IPv6       byte = 0x04
)
View Source
const (
	SocksVersion byte = 0x05
)

Variables

View Source
var (
	InvalidCreds   error = errors.New("invalid credentials")
	InvalidVersion error = errors.New("invalid subversion")
)

Functions

func DenyRuleset

func DenyRuleset(_ CommandType, _ net.IP, _ uint16) bool

func EmptyRuleset

func EmptyRuleset(_ CommandType, _ net.IP, _ uint16) bool

func NoAuth

func NoAuth(_ *bufio.ReadWriter) error

Types

type AuthProvider

type AuthProvider func(*bufio.ReadWriter) error

func UserPass

func UserPass(user, pass string) AuthProvider

type CommandReply

type CommandReply byte
const (
	Succeeded            CommandReply = 0x00
	ServerFailure        CommandReply = 0x01
	ConnForbidden        CommandReply = 0x02
	NetUnreachable       CommandReply = 0x03
	HostUnreachable      CommandReply = 0x04
	ConnRefused          CommandReply = 0x05
	TTLExpired           CommandReply = 0x06
	CommandNotSupported  CommandReply = 0x07
	AddrTypeNotSupported CommandReply = 0x08
)

type CommandType

type CommandType byte
const (
	Connect      CommandType = 0x01
	Bind         CommandType = 0x02
	UdpAssociate CommandType = 0x03
)

type RulesetValidator

type RulesetValidator func(CommandType, net.IP, uint16) bool

type Server

type Server struct {
	AuthProviders map[byte]AuthProvider
	Ruleset       RulesetValidator
	// contains filtered or unexported fields
}

func CreateServer

func CreateServer() *Server

func (*Server) Close

func (s *Server) Close() error

func (*Server) CloseClients

func (s *Server) CloseClients() (e error)

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(network string, laddr *net.TCPAddr) (e error)

Jump to

Keyboard shortcuts

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