Documentation
¶
Index ¶
Constants ¶
View Source
const ( RULEADD = "ruleadd" RULEDEL = "ruledel" RULELIST = "rulelist" RULEGET = "ruleget" RULECOUNTERS = "rulecounters" )
View Source
const ( COMMAND = "command" DELAY = "delay" DROP = "drop" RETEMPTY = "return_empty" RETERR = "return_err" CLIENTADDR = "client_addr" PERCENTAGE = "percentage" )
Variables ¶
View Source
var ErrMsg = `{"ok": false, "msg": %s}`
View Source
var ( // ErrNotFound is returned iff SelectRule can't find a Rule that applies ErrNotFound = errors.New("no matching rule found") )
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func (*Controller) Start ¶
func (c *Controller) Start() error
type Plan ¶
type Plan struct {
Rules []*Rule `json:"rules,omitempty"`
// contains filtered or unexported fields
}
Plan defines a set of rules to be applied by the proxy
func (*Plan) DeleteRule ¶
DeleteRule deletes the given ruleName if found otherwise it returns ErrNotFound
func (*Plan) ListRules ¶
ListRules returns a slice of all the existing rules the slice will be empty if Plan has no rules
func (*Plan) MarshalCommands ¶
func (p *Plan) MarshalCommands()
type Rule ¶
type Rule struct {
Name string `json:"name,omiempty"`
Delay int `json:"delay,omitempty"`
Drop bool `json:"drop,omitempty"`
ReturnEmpty bool `json:"return_empty,omitempty"`
ReturnErr string `json:"return_err,omitempty"`
Percentage int `json:"percentage,omitempty"`
// SelectRule does prefix matching on this value
ClientAddr string `json:"client_addr,omitempty"`
Command string `json:"command,omitempty"`
// contains filtered or unexported fields
}
Rule is what get's applied on every client message iff it matches it
Click to show internal directories.
Click to hide internal directories.
