Documentation ¶
Index ¶
- func RegisterActionBuilder(pclass, aclass string, builder BuildActionFn)
- func RegisterPluginBuilder(class string, builder BuildPluginFn)
- type ActionDef
- type BuildActionFn
- type BuildPluginFn
- type Builder
- func (b Builder) APIService(name string) (apiservice.Service, bool)
- func (b *Builder) AddLocalNet(s string) error
- func (b *Builder) BuildAction(pname, pclass string, def ActionDef) (nfqueue.Action, error)
- func (b *Builder) BuildPlugin(def PluginDef) (nfqueue.Plugin, error)
- func (b Builder) CachePath(data string) string
- func (b *Builder) CleanUp()
- func (b Builder) DataPath(data string) string
- func (b Builder) LocalNets() []*net.IPNet
- func (b Builder) Logger() yalogi.Logger
- func (b *Builder) OnShutdown(f func() error)
- func (b *Builder) OnStartup(f func() error)
- func (b *Builder) Plugin(name string) (nfqueue.Plugin, bool)
- func (b *Builder) Plugins() []nfqueue.Plugin
- func (b *Builder) Shutdown() error
- func (b *Builder) Start() error
- type Option
- type PluginDef
- type RuleDef
- type RuleItemDef
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterActionBuilder ¶
func RegisterActionBuilder(pclass, aclass string, builder BuildActionFn)
RegisterActionBuilder registers an action builder for class
func RegisterPluginBuilder ¶
func RegisterPluginBuilder(class string, builder BuildPluginFn)
RegisterPluginBuilder registers a plugin builder for class
Types ¶
type ActionDef ¶
type ActionDef struct { // Name must exist and be unique in databases for its correct operation Name string `json:"name"` // Class defines the class Class string `json:"class"` // Disabled Disabled bool `json:"disabled"` // Services is a map of services used by plugin Services map[string]string `json:"services,omitempty"` // Rules is a list of ruleset definitions Rules []RuleItemDef `json:"rules,omitempty"` // OnError stores on error verdict OnError string `json:"onerror,omitempty"` // Opts allow optional fields Opts map[string]interface{} `json:"opts,omitempty"` }
ActionDef is used for construct actions
type BuildActionFn ¶
BuildActionFn defines a function that constructs an action using a definition
type BuildPluginFn ¶
BuildPluginFn defines a function that constructs a plugin
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder constructs plugins and actions using definitions
func (Builder) APIService ¶
func (b Builder) APIService(name string) (apiservice.Service, bool)
APIService returns service by name
func (*Builder) AddLocalNet ¶
AddLocalNet add a local net to builder
func (*Builder) BuildAction ¶
BuildAction creates an action using the plugin name, class and metadata passed as param
func (*Builder) BuildPlugin ¶
BuildPlugin creates a plugin using the metadata passed as param
func (*Builder) OnShutdown ¶
OnShutdown registers the functions that will be executed during shutdown.
type PluginDef ¶
type PluginDef struct { // Name must exist and be unique in databases for its correct operation Name string `json:"name"` // Class defines the class Class string `json:"class"` // Disabled Disabled bool `json:"disabled"` // Services is a map of services used by plugin Services map[string]string `json:"services,omitempty"` // Actions is a list of actions Actions []ActionDef `json:"actions,omitempty"` // Opts allow optional fields Opts map[string]interface{} `json:"opts,omitempty"` }
PluginDef is used for construct plugins
func PluginDefsFromFile ¶
PluginDefsFromFile creates a slice of PluginDef from a file in json format.
type RuleDef ¶
type RuleDef struct { // Merge option Merge bool `json:"merge,omitempty"` // Event stores event level Event string `json:"event,omitempty"` // Log enable logging in action Log bool `json:"log"` // Verdict stores verdict to firewall processors Verdict string `json:"verdict,omitempty"` }
RuleDef stores information about rules
type RuleItemDef ¶
type RuleItemDef struct { // When defines condition When string `json:"when"` // Rule stores definition Rule RuleDef `json:"rule"` }
RuleItemDef defines a set of rules