Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteProxyHeader ¶ added in v1.5.14
WriteProxyHeader extracts remote and local IP address and port combinations from incoming connection and writes the PROXY proto header to the outgoing connection
Types ¶
type DynamicProxy ¶ added in v1.5.14
type DynamicProxy struct { // DialTimeout sets the timeout for establishing the outbound // connection. DialTimeout time.Duration // Lookup returns a target host for the given request. // The proxy will panic if this value is nil. Lookup func(host string) *route.Target // Conn counts the number of connections. Conn gkm.Counter // ConnFail counts the failed upstream connection attempts. ConnFail gkm.Counter // Noroute counts the failed Lookup() calls. Noroute gkm.Counter }
Proxy implements a generic TCP proxying handler.
type Handler ¶
Handler responds to a TCP request.
ServeTCP should write responses to the in connection and close it on return.
type HandlerFunc ¶
type Proxy ¶
type Proxy struct { // DialTimeout sets the timeout for establishing the outbound // connection. DialTimeout time.Duration // Lookup returns a target host for the given request. // The proxy will panic if this value is nil. Lookup func(host string) *route.Target // Conn counts the number of connections. Conn gkm.Counter // ConnFail counts the failed upstream connection attempts. ConnFail gkm.Counter // Noroute counts the failed Lookup() calls. Noroute gkm.Counter }
Proxy implements a generic TCP proxying handler.
type SNIProxy ¶
type SNIProxy struct { // DialTimeout sets the timeout for establishing the outbound // connection. DialTimeout time.Duration // Lookup returns a target host for the given server name. // The proxy will panic if this value is nil. Lookup func(host string) *route.Target // Conn counts the number of connections. Conn gkm.Counter // ConnFail counts the failed upstream connection attempts. ConnFail gkm.Counter // Noroute counts the failed Lookup() calls. Noroute gkm.Counter }
SNIProxy implements an SNI aware transparent TCP proxy which captures the TLS client hello, extracts the host name and uses it for finding the upstream server. Then it replays the ClientHello message and copies data transparently allowing to route a TLS connection based on the SNI header without decrypting it.