socks5

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command byte

Command is a SOCKS Command.

const (
	ConnectCommand   Command = 0x01
	AssociateCommand Command = 0x03
)

func (Command) String

func (cmd Command) String() string

type Server

type Server struct {
	// bind is the address to listen on
	Bind string

	Listener net.Listener

	// ProxyDial specifies the optional proxyDial function for
	// establishing the transport connection.
	ProxyDial statute.ProxyDialFunc
	// ProxyListenPacket specifies the optional proxyListenPacket function for
	// establishing the transport connection.
	ProxyListenPacket statute.ProxyListenPacket
	// PacketForwardAddress specifies the packet forwarding address
	PacketForwardAddress statute.PacketForwardAddress
	// UserConnectHandle gives the user control to handle the TCP CONNECT requests
	UserConnectHandle statute.UserConnectHandler
	// UserAssociateHandle gives the user control to handle the UDP ASSOCIATE requests
	UserAssociateHandle statute.UserAssociateHandler
	// Logger error log
	Logger *slog.Logger
	// Context is default context
	Context context.Context
	// BytesPool getting and returning temporary bytes for use by io.CopyBuffer
	BytesPool statute.BytesPool
}

Server is accepting connections and handling the details of the SOCKS5 protocol

func NewServer

func NewServer(options ...ServerOption) *Server

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

func (*Server) ServeConn

func (s *Server) ServeConn(conn net.Conn) error

type ServerOption

type ServerOption func(*Server)

func WithAssociateHandle

func WithAssociateHandle(handler statute.UserAssociateHandler) ServerOption

func WithBind

func WithBind(bindAddress string) ServerOption

func WithBytesPool

func WithBytesPool(bytesPool statute.BytesPool) ServerOption

func WithConnectHandle

func WithConnectHandle(handler statute.UserConnectHandler) ServerOption

func WithContext

func WithContext(ctx context.Context) ServerOption

func WithLogger

func WithLogger(logger *slog.Logger) ServerOption

func WithPacketForwardAddress

func WithPacketForwardAddress(packetForwardAddress statute.PacketForwardAddress) ServerOption

func WithProxyDial

func WithProxyDial(proxyDial statute.ProxyDialFunc) ServerOption

func WithProxyListenPacket

func WithProxyListenPacket(proxyListenPacket statute.ProxyListenPacket) ServerOption

Jump to

Keyboard shortcuts

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