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 {
// 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
// Lookup returns a target host for the given request.
// The proxy will panic if this value is nil.
Lookup func(host string) *route.Target
// DialTimeout sets the timeout for establishing the outbound
// connection.
DialTimeout time.Duration
}
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 {
// 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
// Lookup returns a target host for the given request.
// The proxy will panic if this value is nil.
Lookup func(host string) *route.Target
// ListenAddr is the actual address the proxy is listening on.
// When PROXY protocol is enabled, this is used for route lookup
// instead of in.LocalAddr() which returns the destination from
// the PROXY header.
ListenAddr string
// DialTimeout sets the timeout for establishing the outbound
// connection.
DialTimeout time.Duration
}
Proxy implements a generic TCP proxying handler.
type SNIProxy ¶
type SNIProxy struct {
// 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
// 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
// DialTimeout sets the timeout for establishing the outbound
// connection.
DialTimeout time.Duration
}
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.
type Server ¶
type Server struct {
Handler Handler
Addr string
// ListenAddr is the actual address the server is listening on.
// This is used for route lookup when PROXY protocol is enabled,
// since in.LocalAddr() returns the destination from the PROXY header.
ListenAddr string
ReadTimeout time.Duration
WriteTimeout time.Duration
// contains filtered or unexported fields
}
Server implements a generic TCP server.