Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine evaluates HTTP requests against a set of rules.
func NewRuleEngine ¶
NewRuleEngine creates a new rule engine
type Rule ¶
type Rule struct {
// The path patterns that can match for this rule.
// - nil means all paths allowed
// - Each []string represents a path pattern (list of segments)
// - a path segment of `*` acts as a wild card.
PathPattern [][]string
// The labels of the host, i.e. ["google", "com"].
// - nil means all hosts allowed
// - A label of `*` acts as a wild card.
// - Exact domain patterns (e.g., "github.com") match ONLY the exact domain (no subdomains)
// - Wildcard patterns starting with "*" (e.g., "*.github.com") match ONLY subdomains (not the base domain)
HostPattern []string
// The allowed http methods.
// - nil means all methods allowed
MethodPatterns map[string]struct{}
// Raw rule string for logging
Raw string
}
Rule represents an allow rule passed to the cli with --allow or read from the config file. Rules have a specific grammar that we need to parse carefully. Example: --allow="method=GET,PATCH domain=wibble.wobble.com, path=/posts/*"
func ParseAllowSpecs ¶
ParseAllowSpecs parses a slice of --allow specs into allow Rules.
Click to show internal directories.
Click to hide internal directories.