Documentation
¶
Index ¶
- Constants
- func AfpacketComputeSize(targetSizeMb int, snaplen int, pageSize int) (frameSize int, blockSize int, numBlocks int, err error)
- func Nofify(engine PktCapEngine)
- type AfpacketEngine
- func (e *AfpacketEngine) GetDirection() pcap.Direction
- func (e *AfpacketEngine) GetFlowCollection() *accounting.FlowCollection
- func (e *AfpacketEngine) GetIsDecodeL4() bool
- func (e *AfpacketEngine) GetNotifyChannel() chan *accounting.FlowCollection
- func (e *AfpacketEngine) GetResetInterval() int64
- func (e *AfpacketEngine) StartCapture() (err error)
- func (e *AfpacketEngine) StartEngine() (err error)
- type AfpacketHandle
- func (h *AfpacketHandle) Close()
- func (h *AfpacketHandle) LinkType() layers.LinkType
- func (h *AfpacketHandle) SetBPFFilter(filter string, snaplen int) (err error)
- func (h *AfpacketHandle) SocketStats() (as afpacket.SocketStats, asv afpacket.SocketStatsV3, err error)
- func (h *AfpacketHandle) ZeroCopyReadPacketData() (data []byte, ci gopacket.CaptureInfo, err error)
- type Capture
- type CaptureLayers
- type LibPcapEngine
- func (e *LibPcapEngine) GetDirection() pcap.Direction
- func (e *LibPcapEngine) GetFlowCollection() *accounting.FlowCollection
- func (e *LibPcapEngine) GetIsDecodeL4() bool
- func (e *LibPcapEngine) GetNotifyChannel() chan *accounting.FlowCollection
- func (e *LibPcapEngine) GetResetInterval() int64
- func (e *LibPcapEngine) StartCapture() (err error)
- func (e *LibPcapEngine) StartEngine() (err error)
- type NflogEngine
- func (e *NflogEngine) GetDirection() pcap.Direction
- func (e *NflogEngine) GetFlowCollection() *accounting.FlowCollection
- func (e *NflogEngine) GetIsDecodeL4() bool
- func (e *NflogEngine) GetNotifyChannel() chan *accounting.FlowCollection
- func (e *NflogEngine) GetResetInterval() int64
- func (e *NflogEngine) StartCapture() (err error)
- func (e *NflogEngine) StartEngine() (err error)
- type PktCapEngine
Constants ¶
View Source
const AfpacketEngineName = "afpacket"
View Source
const DefaultFlowColResetInterval = 1
View Source
const LibPcapEngineName = "libpcap"
View Source
const NflogEngineName = "nflog"
Variables ¶
This section is empty.
Functions ¶
func AfpacketComputeSize ¶
func AfpacketComputeSize(targetSizeMb int, snaplen int, pageSize int) ( frameSize int, blockSize int, numBlocks int, err error)
AfpacketComputeSize computes the block_size and the num_blocks in such a way that the allocated mmap buffer is close to but smaller than target_size_mb. The restriction is that the block_size must be divisible by both the frame size and page size.
func Nofify ¶
func Nofify(engine PktCapEngine)
Types ¶
type AfpacketEngine ¶
type AfpacketEngine struct { IfaceName string Direction pcap.Direction SnapLen int MmapBufferSizeMb int UseVlan bool IsDecodeL4 bool NotifyChannel chan *accounting.FlowCollection FlowCol *accounting.FlowCollection FlowColResetInterval int64 }
func NewAfpacketEngine ¶
func NewAfpacketEngine(ifaceName string, direction pcap.Direction, isDecodeL4 bool, ch chan *accounting.FlowCollection) (engine *AfpacketEngine)
func (*AfpacketEngine) GetDirection ¶
func (e *AfpacketEngine) GetDirection() pcap.Direction
func (*AfpacketEngine) GetFlowCollection ¶
func (e *AfpacketEngine) GetFlowCollection() *accounting.FlowCollection
func (*AfpacketEngine) GetIsDecodeL4 ¶
func (e *AfpacketEngine) GetIsDecodeL4() bool
func (*AfpacketEngine) GetNotifyChannel ¶
func (e *AfpacketEngine) GetNotifyChannel() chan *accounting.FlowCollection
func (*AfpacketEngine) GetResetInterval ¶
func (e *AfpacketEngine) GetResetInterval() int64
func (*AfpacketEngine) StartCapture ¶
func (e *AfpacketEngine) StartCapture() (err error)
func (*AfpacketEngine) StartEngine ¶
func (e *AfpacketEngine) StartEngine() (err error)
type AfpacketHandle ¶
func NewAfpacketHandle ¶
func (*AfpacketHandle) LinkType ¶
func (h *AfpacketHandle) LinkType() layers.LinkType
LinkType returns ethernet link type.
func (*AfpacketHandle) SetBPFFilter ¶
func (h *AfpacketHandle) SetBPFFilter(filter string, snaplen int) (err error)
SetBPFFilter translates a BPF filter string into BPF RawInstruction and applies them.
func (*AfpacketHandle) SocketStats ¶
func (h *AfpacketHandle) SocketStats() (as afpacket.SocketStats, asv afpacket.SocketStatsV3, err error)
SocketStats prints received, dropped, queue-freeze packet stats.
func (*AfpacketHandle) ZeroCopyReadPacketData ¶
func (h *AfpacketHandle) ZeroCopyReadPacketData() (data []byte, ci gopacket.CaptureInfo, err error)
ZeroCopyReadPacketData satisfies ZeroCopyPacketDataSource interface
type Capture ¶
type Capture struct { CaptureLayers IsDecodeL4 bool Direction pcap.Direction FlowCol *accounting.FlowCollection DecodingLayerList []gopacket.DecodingLayer Dec *decoder.LayerDecoder Decoded []gopacket.LayerType FirstLayer gopacket.LayerType L3Fingerprint *accounting.FlowFingerprint L4Fingerprint *accounting.FlowFingerprint L3Bytes *int64 L4Bytes *int64 }
func NewCapture ¶
func NewCapture(engine PktCapEngine) (capture *Capture)
func (*Capture) DecodeAndAccount ¶
func (*Capture) SetFirstLayer ¶
type CaptureLayers ¶
type CaptureLayers struct {
// contains filtered or unexported fields
}
type LibPcapEngine ¶
type LibPcapEngine struct { IfaceName string BpfFilter string Direction pcap.Direction SnapLen int32 IsDecodeL4 bool NotifyChannel chan *accounting.FlowCollection FlowCol *accounting.FlowCollection FlowColResetInterval int64 }
func NewLibPcapEngine ¶
func NewLibPcapEngine(ifaceName, bpfFilter string, direction pcap.Direction, snaplen int32, isDecodeL4 bool, ch chan *accounting.FlowCollection) (engine *LibPcapEngine)
func (*LibPcapEngine) GetDirection ¶
func (e *LibPcapEngine) GetDirection() pcap.Direction
func (*LibPcapEngine) GetFlowCollection ¶
func (e *LibPcapEngine) GetFlowCollection() *accounting.FlowCollection
func (*LibPcapEngine) GetIsDecodeL4 ¶
func (e *LibPcapEngine) GetIsDecodeL4() bool
func (*LibPcapEngine) GetNotifyChannel ¶
func (e *LibPcapEngine) GetNotifyChannel() chan *accounting.FlowCollection
func (*LibPcapEngine) GetResetInterval ¶
func (e *LibPcapEngine) GetResetInterval() int64
func (*LibPcapEngine) StartCapture ¶
func (e *LibPcapEngine) StartCapture() (err error)
func (*LibPcapEngine) StartEngine ¶
func (e *LibPcapEngine) StartEngine() (err error)
type NflogEngine ¶
type NflogEngine struct { IfaceName string GroupId int Direction pcap.Direction IsDecodeL4 bool NotifyChannel chan *accounting.FlowCollection FlowCol *accounting.FlowCollection FlowColResetInterval int64 }
func NewNflogEngine ¶
func NewNflogEngine(ifaceName string, groupId int, direction pcap.Direction, isDecodeL4 bool, ch chan *accounting.FlowCollection) (engine *NflogEngine)
func (*NflogEngine) GetDirection ¶
func (e *NflogEngine) GetDirection() pcap.Direction
func (*NflogEngine) GetFlowCollection ¶
func (e *NflogEngine) GetFlowCollection() *accounting.FlowCollection
func (*NflogEngine) GetIsDecodeL4 ¶
func (e *NflogEngine) GetIsDecodeL4() bool
func (*NflogEngine) GetNotifyChannel ¶
func (e *NflogEngine) GetNotifyChannel() chan *accounting.FlowCollection
func (*NflogEngine) GetResetInterval ¶
func (e *NflogEngine) GetResetInterval() int64
func (*NflogEngine) StartCapture ¶
func (e *NflogEngine) StartCapture() (err error)
func (*NflogEngine) StartEngine ¶
func (e *NflogEngine) StartEngine() (err error)
type PktCapEngine ¶
type PktCapEngine interface { StartEngine() error GetDirection() pcap.Direction GetFlowCollection() *accounting.FlowCollection GetResetInterval() int64 GetIsDecodeL4() bool GetNotifyChannel() chan *accounting.FlowCollection }
Click to show internal directories.
Click to hide internal directories.