Documentation
¶
Index ¶
- Variables
- type Action
- type CbClose
- type CbPacket
- type CbTick
- type Config
- type Error
- type Hooks
- func (h *Hooks) CloseHooks() []CbClose
- func (h *Hooks) Layers() []gopacket.LayerType
- func (h *Hooks) OnClose(fn CbClose)
- func (h *Hooks) OnPacket(layer gopacket.LayerType, fn CbPacket)
- func (h *Hooks) OnTick(fn CbTick)
- func (h *Hooks) PacketHooks() []OnPacket
- func (h *Hooks) PacketHooksByLayer(layer gopacket.LayerType) []OnPacket
- func (h *Hooks) TickHooks() []CbTick
- type OnPacket
- type Option
- type PacketProcessor
- type PacketService
- type Plugin
- type Verdict
Constants ¶
This section is empty.
Variables ¶
var DumpPacketInError = false
DumpPacketInError if a packet dump will be show with the error string
var ErrorsBuffer = 20
ErrorsBuffer sets the default size for error channels
var ShowPacketInError = false
ShowPacketInError if a packet digest will be show with the error string
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action interface { // Name returns the name of the action instance Name() string // Class returns the class name of the action Class() string // PluginClass returns the plugin class implemented by the action PluginClass() string }
Action defines interface for actions (used by plugins)
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is used for packet processing
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
Hooks is responsible for packet processor
func (*Hooks) PacketHooks ¶
PacketHooks returns on packet hooks in order
func (*Hooks) PacketHooksByLayer ¶
PacketHooksByLayer returns on packet hooks by layer
type PacketProcessor ¶
type PacketProcessor interface {
Process(qid int, hooks *Hooks) (stop func(), errs <-chan error, err error)
}
PacketProcessor attach to a netfilter queue with the qid
func NewProcessor ¶
func NewProcessor(cfg Config, logger yalogi.Logger) PacketProcessor
NewProcessor creates a new basic go-nfqueue processor
type PacketService ¶
type PacketService struct {
// contains filtered or unexported fields
}
PacketService manages multiple nfqueues
func NewService ¶
func NewService(p PacketProcessor, plugins []Plugin, opt ...Option) *PacketService
NewService creates a new Service
func (*PacketService) Register ¶
func (s *PacketService) Register(qid int) error
Register packet source with name and start it if service is started
func (*PacketService) Shutdown ¶
func (s *PacketService) Shutdown()
Shutdown the service and stop processing registered packet sources
func (*PacketService) Unregister ¶
func (s *PacketService) Unregister(qid int) error
Unregister queue by id, stopping if it's started
type Plugin ¶
type Plugin interface { // Name returns the name of the plugin instance Name() string // Class returns the class name of the plugin Class() string // Register add hooks to a the packet processing pipeline Register(hooks *Hooks) // Layers returns layers required by the plugin Layers() []gopacket.LayerType // CleanUp of the plugin CleanUp() }
Plugin defines interface for packet processing plugins