Documentation ¶
Overview ¶
Package policy defines the network policy that the proxy can choose to enforce.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterRule ¶
RegisterRule adds a rule to the rule registry. The rule registry contains implementations of the Rule interface recognized by the proxy. Updates to the policy will try to unmarshal json structs into the registered rules. Expects the rule name and a constructor returning the Rule type.
Types ¶
type MatchingType ¶
type MatchingType string
const ( FullMatch MatchingType = "full" PrefixMatch MatchingType = "prefix" )
type Policy ¶
type Policy struct { // AnyOf expects incoming requests to satisfy one of these Rules. AnyOf []Rule `json:"anyOf"` }
Policy contains a list of Rules that will be applied to the request.
func (Policy) Apply ¶
Apply enforces the policy on the request. Returns http.StatusForbidden if the request does not satisfy the policy rules.
func (*Policy) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for the Policy class. Expects rule_type to specify an existing rule in the rule registry.
type URLMatchRule ¶
type URLMatchRule struct { Host string `json:"host"` Path string `json:"path"` PathMatch MatchingType `json:"matchPathBy"` }
Implements the Rule interface. Matches the request URL based on the MatchingType.