Documentation ¶
Overview ¶
Package sniproxy is responsible for the SNI and plain HTTP proxy that will listen for incoming TLS/HTTP connections, read the server name either from the SNI field of ClientHello or from the HTTP Host header, and tunnel traffic to the respective hosts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // TLSListenAddr is the listen address the SNI proxy will be listening to // TLS connections. TLSListenAddr *net.TCPAddr // HTTPListenAddr is the listen address the SNI proxy will be listening to // plain HTTP connections. HTTPListenAddr *net.TCPAddr // ForwardProxy is the address of the SOCKS5 proxy that the connections will // be forwarded to according to ForwardRules. ForwardProxy string // ForwardRules is a list of wildcards that define what connections will be // forwarded to the proxy using ForwardProxy. If the list is empty and // ForwardProxy is set, all connections will be forwarded. ForwardRules []string // BlockRules is a list of wildcards that define connections to which hosts // will be blocked. BlockRules []string // DropRules is a list of wildcards that define connections to which hosts // will be dropped. "Dropped" means that they will be delayed for a specific // period of time. DropRules []string // BandwidthRate is a number of bytes per second the connections speed will // be limited to. If not set, there is no limit. BandwidthRate float64 // BandwidthRules is a map that allows to define connection speed for // domains that match the wildcards. Has higher priority than // BandwidthRate. BandwidthRules map[string]float64 }
Config is the SNI proxy configuration.
type SNIContext ¶
type SNIContext struct { // ID is a unique connection ID. ID uint64 // RemoteHost is the hostname that was parsed from the connection's TLS // ClientHello. RemoteHost string // RemoteAddr is the address the proxy will connect to. Basically, it is // just remoteHost:remotePort. RemoteAddr string }
SNIContext represents a single tunnel connection context.
func NewSNIContext ¶
func NewSNIContext(remoteHost string, remoteAddr string) (c *SNIContext)
NewSNIContext creates a new instance of *SNIContext.
type SNIProxy ¶
type SNIProxy struct {
// contains filtered or unexported fields
}
SNIProxy is a struct that manages the SNI proxy server. This server's purpose is to handle TLS connections and tunnel them to the respective hosts. Also, it can handle plain HTTP connections, parse the target host and tunnel traffic there.