Documentation
¶
Overview ¶
Package utils provides flow pipeline and transport helpers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutoFlowPipe ¶ added in v2.1.0
type AutoFlowPipe struct {
*SFlowPipe
*NetFlowPipe
}
AutoFlowPipe dispatches to sFlow or NetFlow pipes based on payload.
func NewFlowPipe ¶ added in v2.1.0
func NewFlowPipe(cfg *PipeConfig) *AutoFlowPipe
NewFlowPipe creates a combined sFlow and NetFlow decoder.
func (*AutoFlowPipe) Close ¶ added in v2.1.0
func (p *AutoFlowPipe) Close()
func (*AutoFlowPipe) DecodeFlow ¶ added in v2.1.0
func (p *AutoFlowPipe) DecodeFlow(msg interface{}) error
DecodeFlow detects the protocol and routes to the appropriate decoder.
type BatchMute ¶ added in v2.1.2
type BatchMute struct {
// contains filtered or unexported fields
}
BatchMute throttles events by limiting count per interval.
func NewBatchMute ¶ added in v2.1.2
NewBatchMute creates a BatchMute with a reset interval and max count.
type DecoderFunc ¶
type DecoderFunc func(msg interface{}) error
DecoderFunc decodes a received UDP message.
type FlowPipe ¶
type FlowPipe interface {
DecodeFlow(msg interface{}) error
Close()
}
FlowPipe describes a flow decoder/formatter pipeline.
type NetFlowPipe ¶
type NetFlowPipe struct {
// contains filtered or unexported fields
}
NetFlowPipe decodes NetFlow/IPFIX packets and forwards them to a producer.
func NewNetFlowPipe ¶
func NewNetFlowPipe(cfg *PipeConfig) *NetFlowPipe
NewNetFlowPipe creates a flow pipe configured for NetFlow/IPFIX packets.
func (*NetFlowPipe) Close ¶
func (p *NetFlowPipe) Close()
func (*NetFlowPipe) DecodeFlow ¶
func (p *NetFlowPipe) DecodeFlow(msg interface{}) error
DecodeFlow decodes a NetFlow/IPFIX payload and emits producer messages.
func (*NetFlowPipe) GetTemplatesForAllSources ¶ added in v2.2.4
func (p *NetFlowPipe) GetTemplatesForAllSources() map[string]map[uint64]interface{}
GetTemplatesForAllSources returns a copy of templates for all known NetFlow sources.
type PipeConfig ¶
type PipeConfig struct {
Format format.FormatInterface
Transport transport.TransportInterface
Producer producer.ProducerInterface
NetFlowTemplater templates.TemplateSystemGenerator
}
PipeConfig wires formatter, transport, and producer dependencies.
type PipeMessageError ¶
PipeMessageError wraps a decode/produce error with source message metadata.
func (*PipeMessageError) Error ¶
func (e *PipeMessageError) Error() string
func (*PipeMessageError) Unwrap ¶
func (e *PipeMessageError) Unwrap() error
type ReceiverCallback ¶ added in v2.1.1
type ReceiverCallback interface {
Dropped(msg Message)
}
ReceiverCallback is notified when packets are dropped.
type ReceiverError ¶
type ReceiverError struct {
Err error
}
ReceiverError wraps errors from UDP receive routines.
func (*ReceiverError) Error ¶
func (e *ReceiverError) Error() string
func (*ReceiverError) Unwrap ¶
func (e *ReceiverError) Unwrap() error
type SFlowPipe ¶
type SFlowPipe struct {
// contains filtered or unexported fields
}
SFlowPipe decodes sFlow packets and forwards them to a producer.
func NewSFlowPipe ¶
func NewSFlowPipe(cfg *PipeConfig) *SFlowPipe
NewSFlowPipe creates a flow pipe configured for sFlow packets.
func (*SFlowPipe) DecodeFlow ¶
DecodeFlow decodes a sFlow payload and emits producer messages.
type UDPReceiver ¶
type UDPReceiver struct {
// contains filtered or unexported fields
}
UDPReceiver receives UDP packets and dispatches them to decoders.
func NewUDPReceiver ¶
func NewUDPReceiver(cfg *UDPReceiverConfig) (*UDPReceiver, error)
NewUDPReceiver creates a UDP receiver with the provided configuration.
func (*UDPReceiver) Errors ¶
func (r *UDPReceiver) Errors() <-chan error
Errors returns a channel of receiver errors.
func (*UDPReceiver) Start ¶
func (r *UDPReceiver) Start(addr string, port int, decodeFunc DecoderFunc) error
Start runs UDP receivers and processing routines.
func (*UDPReceiver) Stop ¶
func (r *UDPReceiver) Stop() error
Stop stops the receiver and worker routines.
type UDPReceiverConfig ¶
type UDPReceiverConfig struct {
Workers int
Sockets int
Blocking bool
QueueSize int
ReceiverCallback ReceiverCallback
}
UDPReceiverConfig configures UDP receiver workers and sockets.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package debug provides panic-wrapping helpers for decoders and producers.
|
Package debug provides panic-wrapping helpers for decoders and producers. |
|
Package templates provides NetFlow/IPFIX template system helpers.
|
Package templates provides NetFlow/IPFIX template system helpers. |