Documentation ¶
Index ¶
- Variables
- func FloatP(value float64) *float64
- func IntP(value int) *int
- func Parse(rule string, target interface{}) error
- func StringP(value string) *string
- func ValidateParameterCount(params []Param, expected int) error
- type CIDR
- type Call
- type ChainedResponsePipeline
- type Check
- type CheckScript
- type FilteredPipeline
- type Filters
- type Param
- type SingleResponsePipeline
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoTerminatorDefined = errors.New("no terminator defined") ErrUnknownTerminator = errors.New("no terminator with the given name is known") ErrUnknownFilterMethod = errors.New("no filter with the given name is known") ErrNoInitiatorDefined = errors.New("no initiator defined") ErrUnknownInitiator = errors.New("no initiator with the given name is known") )
var ( ErrNoParser = errors.New("no parser available for given type") ErrTypeMismatch = errors.New("param has a different type") )
var ErrAmbiguousParamCount = errors.New("the supplied number of arguments does not match the expected one")
Functions ¶
func Parse ¶
Parse takes a raw rule and parses it into the given target instance currently only SingleResponsePipeline and Check are supported for parsing
func ValidateParameterCount ¶
Types ¶
type ChainedResponsePipeline ¶ added in v0.8.0
type ChainedResponsePipeline struct { FilterChain *Filters `parser:"@@*"` Response []Call `parser:"'=>' @@ ('=>' @@)*"` }
ChainedResponsePipeline describes how requests are handled that expect a chain of response handlers e.g. DHCP where one handler might set the IP, one sets the default gateway, one sets the DNS servers and so on A ChainedResponsePipeline is defined as an optional chain of Filters like: filter1() -> filter2() and a chain of Response handlers while at least one has to be present // a full chain might look like so: MatchMAC(`00:06:7C:.*`) => IP(3.3.6.6) => Router(1.2.3.4) => DNS(1.2.3.4, 4.5.6.7)
func (*ChainedResponsePipeline) Filters ¶ added in v0.8.0
func (p *ChainedResponsePipeline) Filters() []Call
type CheckScript ¶
type CheckScript struct {
Checks []Check `parser:"@@*"`
}
type FilteredPipeline ¶ added in v0.8.0
type FilteredPipeline interface {
Filters() []Call
}
type Param ¶
type SingleResponsePipeline ¶ added in v0.8.0
type SingleResponsePipeline struct { FilterChain *Filters `parser:"@@*"` Response *Call `parser:"'=>' @@"` }
SingleResponsePipeline describes how requests are handled that expect single response e.g. HTTP or DNS requests A SingleResponsePipeline is defined as an optional chain of Filters like: filter1() -> filter2() and a Response which determines how the request should be handled e.g. http.Status(204) a full chain might look like so: GET() -> Header("Accept", "application/json") -> http.Status(200).
func (*SingleResponsePipeline) Filters ¶ added in v0.8.0
func (p *SingleResponsePipeline) Filters() []Call