Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handler ¶
type Handler struct {
// How long to wait for the PROXY protocol header to be received.
// Defaults to zero, which means timeout is disabled.
Timeout caddy.Duration `json:"timeout,omitempty"`
// An optional list of CIDR ranges to allow/require PROXY headers from.
Allow []string `json:"allow,omitempty"`
// Deny is an optional list of CIDR ranges to
// deny PROXY headers from.
Deny []string `json:"deny,omitempty"`
// FallbackPolicy specifies the policy to use if the downstream
// IP address is not in the Allow list nor is in the Deny list.
//
// NOTE: The generated docs which describe the value of this
// field is wrong because of how this type unmarshals JSON in a
// custom way. The field expects a string, not a number.
//
// Accepted values are: IGNORE, USE, REJECT, REQUIRE, SKIP
//
// - IGNORE: address from PROXY header, but accept connection
//
// - USE: address from PROXY header
//
// - 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.
//
// - 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.
//
// - SKIP: accepts a connection without requiring the PROXY header.
// Note: an example usage can be found in the SkipProxyHeaderForCIDR
// function.
//
// Default: IGNORE
//
// Policy definitions are here: https://pkg.go.dev/github.com/pires/go-proxyproto#Policy
FallbackPolicy Policy `json:"fallback_policy,omitempty"`
// contains filtered or unexported fields
}
Handler is a connection handler that accepts the PROXY protocol.
func (*Handler) CaddyModule ¶
func (*Handler) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
type MatchProxyProtocol ¶
type MatchProxyProtocol struct{}
func (*MatchProxyProtocol) CaddyModule ¶
func (*MatchProxyProtocol) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*MatchProxyProtocol) Match ¶
func (m *MatchProxyProtocol) Match(cx *layer4.Connection) (bool, error)
Match returns true if the connection looks like it is using the Proxy Protocol.
func (*MatchProxyProtocol) UnmarshalCaddyfile ¶
func (m *MatchProxyProtocol) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
UnmarshalCaddyfile sets up the MatchProxyProtocol from Caddyfile tokens. Syntax:
proxy_protocol
type Policy ¶
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 ¶
MarshalText implements the text marshaller method.
func (*Policy) UnmarshalText ¶
UnmarshalText implements the text unmarshaller method.
Click to show internal directories.
Click to hide internal directories.