Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ListenerWrapper ¶
type ListenerWrapper struct { // Timeout specifies an optional maximum time for // the PROXY header to be received. // If zero, timeout is disabled. Default is 5s. Timeout caddy.Duration `json:"timeout,omitempty"` // Allow is an optional list of CIDR ranges to // allow/require PROXY headers from. Allow []string `json:"allow,omitempty"` // Denby is an optional list of CIDR ranges to // deny PROXY headers from. Deny []string `json:"deny,omitempty"` // Accepted values are: ignore, use, reject, require, skip // default: ignore // Policy definitions are here: https://pkg.go.dev/github.com/pires/go-proxyproto@v0.7.0#Policy FallbackPolicy Policy `json:"fallback_policy,omitempty"` // contains filtered or unexported fields }
ListenerWrapper provides PROXY protocol support to Caddy by implementing the caddy.ListenerWrapper interface. It must be loaded before the `tls` listener.
Credit goes to https://github.com/mastercactapus/caddy2-proxyprotocol for having initially implemented this as a plugin.
func (ListenerWrapper) CaddyModule ¶
func (ListenerWrapper) CaddyModule() caddy.ModuleInfo
func (*ListenerWrapper) Provision ¶
func (pp *ListenerWrapper) Provision(ctx caddy.Context) error
Provision sets up the listener wrapper.
func (*ListenerWrapper) UnmarshalCaddyfile ¶
func (w *ListenerWrapper) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
UnmarshalCaddyfile sets up the listener Listenerwrapper from Caddyfile tokens. Syntax:
proxy_protocol { timeout <duration> allow <IPs...> deny <IPs...> fallback_policy <policy> }
func (*ListenerWrapper) WrapListener ¶
func (pp *ListenerWrapper) WrapListener(l net.Listener) net.Listener
WrapListener adds PROXY protocol support to the listener.
type Policy ¶ added in v2.8.0
type Policy int
const ( // IGNORE address from PROXY header, but accept connection PolicyIGNORE Policy = iota // USE address from PROXY header PolicyUSE // REJECT connection when PROXY header is sent // Note: even though the first read on the connection returns an error if // a PROXY header is present, subsequent reads do not. It is the task of // the code using the connection to handle that case properly. PolicyREJECT // REQUIRE connection to send PROXY header, reject if not present // Note: even though the first read on the connection returns an error if // a PROXY header is not present, subsequent reads do not. It is the task // of the code using the connection to handle that case properly. PolicyREQUIRE // SKIP accepts a connection without requiring the PROXY header // Note: an example usage can be found in the SkipProxyHeaderForCIDR // function. PolicySKIP )
as defined in: https://pkg.go.dev/github.com/pires/go-proxyproto@v0.7.0#Policy
func (Policy) MarshalText ¶ added in v2.8.0
MarshalText implements the text marshaller method.
func (*Policy) UnmarshalText ¶ added in v2.8.0
UnmarshalText implements the text unmarshaller method.