Documentation ¶
Index ¶
Constants ¶
View Source
const ( // SO_ORIGINAL_DST is a Linux getsockopt optname. SO_ORIGINAL_DST = 80 // IP6T_SO_ORIGINAL_DST a Linux getsockopt optname. IP6T_SO_ORIGINAL_DST = 80 )
View Source
const ( // ModeNAT is mode constant for NAT. ModeNAT = Mode("nat") )
Variables ¶
This section is empty.
Functions ¶
func GetOriginalDST ¶
GetOriginalDST retrieves the original destination address from NATed connection. Currently, only Linux iptables using DNAT/REDIRECT is supported. For other operating systems, this will just return conn.LocalAddr().
Note that this function only works when nf_conntrack_ipv4 and/or nf_conntrack_ipv6 is loaded in the kernel.
Types ¶
type Config ¶
type Config struct { // Addr is the listening address. Addr string // ProxyURL is the URL for upstream proxy. // // For SOCKS5, URL looks like "socks5://USER:PASSWORD@HOST:PORT". // // For HTTP proxy, URL looks like "http://USER:PASSWORD@HOST:PORT". // The HTTP proxy must support CONNECT method. ProxyURL *url.URL // Mode determines how clients are routed to transocks. // Default is ModeNAT. No other options are available at this point. Mode Mode // ShutdownTimeout is the maximum duration the server waits for // all connections to be closed before shutdown. // // Zero duration disables timeout. Default is 1 minute. ShutdownTimeout time.Duration // Dialer is the base dialer to connect to the proxy server. // The server uses the default dialer if this is nil. Dialer *net.Dialer // Logger can be used to provide a custom logger. // If nil, the default logger is used. Logger *log.Logger // Env can be used to specify a cmd.Environment on which the server runs. // If nil, the server will run on the global environment. Env *cmd.Environment }
Config keeps configurations for Server.
Click to show internal directories.
Click to hide internal directories.