Documentation
¶
Overview ¶
Package handler defines the request type flowing through the SOCKS5 server, the per-command Handler/Middleware extension points, and the AddressRewriter hook for mutating destinations before dialing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressRewriter ¶
type AddressRewriter interface {
Rewrite(ctx context.Context, request *Request) (context.Context, *protocol.AddrSpec)
}
AddressRewriter mutates the destination of a request before rules run and the target is dialed. Returning a nil AddrSpec keeps the current destination; the returned context replaces the request context when non-nil.
type Handler ¶
Handler processes one SOCKS5 command (CONNECT, BIND or UDP ASSOCIATE). writer is the client control connection; the handler is responsible for sending the SOCKS reply and relaying traffic.
type Middleware ¶
Middleware runs before the command handler. Returning a non-nil error aborts the request without invoking the handler.
type MiddlewareChain ¶
type MiddlewareChain []Middleware
MiddlewareChain is an ordered list of Middleware executed front to back.
type Request ¶
type Request struct {
protocol.Request
Context context.Context
Metadata map[string]string
AuthContext *auth.AContext
LocalAddr net.Addr
RemoteAddr net.Addr
DestAddr *protocol.AddrSpec
Reader io.Reader
RawDestAddr *protocol.AddrSpec
}
Request is a parsed SOCKS5 command request enriched with connection state. RawDestAddr is the destination exactly as sent by the client; DestAddr is the effective destination after resolution and rewriting. Reader wraps the client connection and must not be retained after the request completes.