socks

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendReply

func SendReply(w io.Writer, rep uint8, addr *AddrSpec) error

SendReply is used to send a reply message to a client

Types

type AddrSpec

type AddrSpec struct {
	FQDN string
	IP   net.IP
	Port int
}

AddrSpec is used to return the target AddrSpec which may be specified as IPv4, IPv6, or a FQDN

func (AddrSpec) Address

func (a AddrSpec) Address() string

Address returns a string suitable to dial; prefer returning IP-based address, fallback to FQDN

func (*AddrSpec) String

func (a *AddrSpec) String() string

type Request

type Request struct {
	// Protocol version
	Version uint8
	// Requested command
	Command uint8
	// AddrSpec of the the network that sent the request
	RemoteAddr *AddrSpec
	// AddrSpec of the desired destination
	DestAddr *AddrSpec
}

A Request represents request received by a server

func (*Request) ParseRequest

func (r *Request) ParseRequest(conn net.Conn) error

ParseRequest is used to parse a request from a client

type SocksServer

type SocksServer struct {
	// contains filtered or unexported fields
}

func NewSocksServer

func NewSocksServer(addr string, logger *zap.Logger, pool *ants.Pool) *SocksServer

func (*SocksServer) HandleAuth

func (ss *SocksServer) HandleAuth(conn net.Conn) error

func (*SocksServer) HandleRequest

func (ss *SocksServer) HandleRequest(conn net.Conn) error

Handle client requests

func (*SocksServer) Run

func (ss *SocksServer) Run() error

func (*SocksServer) SocksService

func (ss *SocksServer) SocksService(conn net.Conn) error

Jump to

Keyboard shortcuts

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