Documentation
¶
Overview ¶
Package socks5test provides a minimal in-process RFC 1928 / RFC 1929 SOCKS5 server for tests.
It listens on loopback, records every CONNECT request it receives, and either relays to the requested target or answers with a configured failure code. Domain-name targets (`socks5h`) resolve through a fixed in-memory table, so tests never touch real DNS or the internet.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Request ¶
type Request struct {
// Domain is true when the client sent ATYP DOMAINNAME (remote DNS).
Domain bool
// Host is the requested IP literal or domain name.
Host string
Port int
}
Request is one CONNECT request seen by the server.
type Server ¶
type Server struct {
// User and Pass, when User is non-empty, require RFC 1929 username/password authentication.
User, Pass string
// Hosts maps domain names to the address they resolve to at the proxy (remote DNS).
Hosts map[string]string
// Reply, when non-zero, answers every CONNECT with this SOCKS reply code instead of relaying.
Reply byte
// Stall makes the server accept connections and never answer (handshake timeout tests).
Stall bool
// contains filtered or unexported fields
}
Server is an in-process SOCKS5 proxy.
func (*Server) AuthFailures ¶
AuthFailures returns how many RFC 1929 authentications were rejected.