handler

package
v1.40.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const HintsHeaderName = "X-Src-IP-Hints"

Variables

This section is empty.

Functions

func DummyListen added in v1.34.0

func DummyListen(network, address string) (net.Listener, error)

func PortForwardHandler added in v1.37.0

func PortForwardHandler(logger *clog.CondLogger, dialer HandlerDialer, address string, forward ForwardFunc) func(context.Context, net.Conn)

func SOCKSHandler added in v1.31.0

func SOCKSHandler(dialer HandlerDialer, logger *clog.CondLogger, forward ForwardFunc) func(ctx context.Context, writer io.Writer, request *socks5.Request) error

func StdIOHandler added in v1.34.0

func StreamServe added in v1.37.0

func StreamServe(l net.Listener, h func(conn net.Conn)) error

Types

type Config added in v1.14.1

type Config struct {
	// Dialer optionally specifies dialer to use for creating
	// connections originating from proxy.
	Dialer HandlerDialer
	// Auth optionally specifies request validator used to verify users
	// and return their username.
	Auth auth.Auth
	// Logger specifies optional custom logger.
	Logger *clog.CondLogger
	// Forward optionally specifies custom connection pairing function
	// which does actual data forwarding.
	Forward ForwardFunc
	// UserIPHints specifies whether allow IP hints set by user or not
	UserIPHints bool
}

type DummyAddress added in v1.34.0

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

func (DummyAddress) Network added in v1.34.0

func (a DummyAddress) Network() string

func (DummyAddress) String added in v1.34.0

func (a DummyAddress) String() string

type DummyListener added in v1.34.0

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

func (*DummyListener) Accept added in v1.34.0

func (l *DummyListener) Accept() (net.Conn, error)

Accept waits for and returns the next connection to the listener.

func (*DummyListener) Addr added in v1.34.0

func (l *DummyListener) Addr() net.Addr

Addr returns the listener's network address.

func (*DummyListener) Close added in v1.34.0

func (l *DummyListener) Close() error

Close closes the listener. Any blocked Accept operations will be unblocked and return errors.

type DummySocksResolver added in v1.37.0

type DummySocksResolver struct{}

func (DummySocksResolver) Resolve added in v1.37.0

func (_ DummySocksResolver) Resolve(ctx context.Context, name string) (context.Context, net.IP, error)

type ForwardFunc added in v1.31.0

type ForwardFunc = func(ctx context.Context, username string, incoming, outgoing io.ReadWriteCloser, network, address string) error

type HandlerDialer

type HandlerDialer interface {
	DialContext(ctx context.Context, net, address string) (net.Conn, error)
}

type ProxyHandler

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

func NewProxyHandler

func NewProxyHandler(config *Config) *ProxyHandler

func (*ProxyHandler) HandleGetRandom added in v1.28.0

func (s *ProxyHandler) HandleGetRandom(wr http.ResponseWriter, req *http.Request, username string)

func (*ProxyHandler) HandleRequest

func (s *ProxyHandler) HandleRequest(wr http.ResponseWriter, req *http.Request, username string)

func (*ProxyHandler) HandleTunnel

func (s *ProxyHandler) HandleTunnel(wr http.ResponseWriter, req *http.Request, username string)

func (*ProxyHandler) ServeHTTP

func (s *ProxyHandler) ServeHTTP(wr http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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