socks4

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: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddrAnfUser

type AddrAnfUser struct {
	Username string
	// contains filtered or unexported fields
}

func (AddrAnfUser) Address

func (a AddrAnfUser) Address() string

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

func (*AddrAnfUser) Network

func (a *AddrAnfUser) Network() string

func (*AddrAnfUser) String

func (a *AddrAnfUser) String() string

type Command

type Command byte

Command is a SOCKS Command.

const (
	ConnectCommand Command = 0x01
)

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
	// UserConnectHandle gives the user control to handle the TCP CONNECT requests
	UserConnectHandle statute.UserConnectHandler
	// 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 SOCKS4 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 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 WithProxyDial

func WithProxyDial(proxyDial statute.ProxyDialFunc) ServerOption

Jump to

Keyboard shortcuts

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