Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrRuleNotFound = errors.New("vinxi: rule does not exists")
ErrRuleNotFound is used when a rule does not exists.
var Rules = make(map[string]Info)
Rules is used to store the existent rules globally.
Functions ¶
Types ¶
type Factory ¶
Factory represents the rule factory function interface.
func GetFactory ¶
GetFactory is used to find and retrieve a rule factory function.
type Field ¶
type Field struct { Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` Description string `json:"description,omitempty"` Mandatory bool `json:"mandatory,omitempty"` Examples []string `json:"examples,omitempty"` Default interface{} `json:"default,omitempty"` Validator Validator `json:"-"` }
Field is used to declare specific config fields supported by rules.
type Info ¶
type Info struct { Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Params Params `json:"params,omitempty"` Factory Factory `json:"-"` }
Info represents the rule entity fields storing the name, description and factory function used to initialize the fields.
type Layer ¶
type Layer struct {
// contains filtered or unexported fields
}
Layer represents a rules layer designed to intrument proxies providing plugin based dynamic configuration capabilities, such as register/unregister or enable/disable rules at runtime satefy.
func (*Layer) Match ¶
Match matches the given http.Request agains the registered rules. If all the rules passes it will return true, otherwise false.
type Matcher ¶
Matcher represents the matching function interface used by rules to determine if a given traffic should be filtered or not.
type Rule ¶
type Rule interface { // ID returns the rule unique identifier. ID() string // Name returns the rule semantic alias. Name() string // Description is used to retrieve the rule semantic description. Description() string // Config is used to retrieve the rule config. Config() config.Config // Match is used to determine if a given http.Request // passes the rule assertion. Match(*http.Request) bool }
Rule represents the required interface implemented by HTTP traffic rules.
Rule is designed to inspect an incoming HTTP traffic and determine if should trigger the registered plugins if the rule matches.