Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrProxyProtocolV1HeaderInvalid = errors.New("PROXY Protocol v1 header is invalid") ErrProxyProtocolV2HeaderInvalid = errors.New("PROXY Protocol v2 header is invalid") ErrProxyProtocolInvalid = errors.New("Invalid PROXY Protocol Header") ErrHeaderReadTimeout = errors.New("Header read timeout") )
Functions ¶
func IsProxyProtocolError ¶
func NewLazyListener ¶ added in v1.0.1
func NewLazyListener(listener net.Listener, allowedIPs string, headerReadTimeout int, fallbackable bool) (net.Listener, error)
Create new PROXY protocol listener for lazy mode. Lazy mode means PROXY protocol header will be processed at first `Read` call. * listener is basic listener for TCP * allowedIPs is protocol allowed addresses or CIDRs split by `,` if use '*' means allow any address * headerReadTimeout is timeout for PROXY protocol header read
func NewListener ¶
func NewListener(listener net.Listener, allowedIPs string, headerReadTimeout int, fallbackable bool) (net.Listener, error)
Create new PROXY protocol listener * listener is basic listener for TCP * allowedIPs is protocol allowed addresses or CIDRs split by `,` if use '*' means allow any address * headerReadTimeout is timeout for PROXY protocol header read
Types ¶
type UnderlayConn ¶ added in v1.0.8
type UnderlayConn interface {
// NetConn returns the underlying net.Conn that this connection wraps.
NetConn() net.Conn
}
UnderlayConn is implemented by connections that wrap an underlying net.Conn and can hand it back. Its single method mirrors the exported API of *crypto/tls.Conn (NetConn() net.Conn), so callers can unwrap either kind of connection through one shared interface, for example to reach syscall.Conn and inspect the underlying file descriptor.