Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandleVars ¶
HandleVars is able to set custom context variables to have values that can be used in the Layer 4 connection handler chain. The primary way to access variables is with placeholders, which have the form: `{l4.vars.variable_name}`, or with the `vars` and `vars_regexp` connection matchers.
The key is the variable name, and the value is the value of the variable. Both the name and value may use or contain placeholders.
func (*HandleVars) CaddyModule ¶
func (*HandleVars) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*HandleVars) Handle ¶
func (h *HandleVars) Handle(cx *layer4.Connection, next layer4.Handler) error
Handle sets custom context variables for the connection.
func (*HandleVars) UnmarshalCaddyfile ¶
func (h *HandleVars) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
UnmarshalCaddyfile sets up the HandleVars from Caddyfile tokens. Syntax:
vars [<variable> <value>] {
<variable> <value>
...
}
type MatchVars ¶
MatchVars is able to match connections based on variables in the context or placeholder values. The key is the placeholder or name of the variable, and the values are possible values the variable can be in order to match (logical OR'ed).
If the key is surrounded by `{ }`, it is assumed to be a placeholder. Otherwise, it will be considered a variable name.
Placeholders in the keys are not expanded, but placeholders in the values are.
func (*MatchVars) CaddyModule ¶
func (*MatchVars) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
type MatchVarsRE ¶
type MatchVarsRE map[string]*layer4.MatchRegexp
MatchVarsRE matches variables in the context or placeholder values against a given regular expression.
Upon a match, it adds placeholders to the connection: `{l4.regexp.name.capture_group}` where `name` is the regular expression's name, and `capture_group` is either the named or positional capture group from the expression itself. If no name is given, then the placeholder omits the name: `{l4.regexp.capture_group}` (potentially leading to collisions).
func (*MatchVarsRE) CaddyModule ¶
func (*MatchVarsRE) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*MatchVarsRE) Match ¶
func (m *MatchVarsRE) Match(cx *layer4.Connection) (bool, error)
Match returns true if the connection satisfies the applicable criteria, i.e. the context variables or placeholders match the given regular expressions.
func (*MatchVarsRE) Provision ¶
func (m *MatchVarsRE) Provision(ctx caddy.Context) error
Provision compiles m's regular expressions.
func (*MatchVarsRE) UnmarshalCaddyfile ¶
func (m *MatchVarsRE) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
UnmarshalCaddyfile sets up the MatchVarsRE from Caddyfile tokens. Syntax:
vars_regexp [<name>] <variable> <regexp>
func (*MatchVarsRE) Validate ¶
func (m *MatchVarsRE) Validate() error
Validate validates m's regular expressions.