Documentation
¶
Overview ¶
Package nfdump provides an API for nfdump files
Index ¶
- Constants
- type DataBlock
- type DataBlockHeader
- type EXasRouting
- type EXcntFlow
- type EXflowMisc
- type EXgenericFlow
- type EXip
- type EXvLan
- type FlowRecordV3
- func (flowRecord *FlowRecordV3) AsRouting() *EXasRouting
- func (flowRecord *FlowRecordV3) CntFlow() *EXcntFlow
- func (flowRecord *FlowRecordV3) FlowMisc() *EXflowMisc
- func (flowRecord *FlowRecordV3) GenericFlow() *EXgenericFlow
- func (flowRecord *FlowRecordV3) IP() *EXip
- func (flowRecord *FlowRecordV3) String() string
- func (flowRecord *FlowRecordV3) VLan() *EXvLan
- type NfFile
- func (nfFile *NfFile) AllRecords() (chan *FlowRecordV3, error)
- func (nfFile *NfFile) Close() error
- func (nfFile *NfFile) Ident() string
- func (nfFile *NfFile) Open(fileName string) error
- func (nfFile *NfFile) ReadDataBlocks() (chan DataBlock, error)
- func (nfFile *NfFile) Stat() StatRecord
- func (nfFile *NfFile) String() string
- type NfFileHeader
- type NfFileHeaderV1
- type StatRecord
Constants ¶
View Source
const ( NUM_FLAGS = 4 FLAG_NOT_COMPRESSED = 0x0 // records are not compressed FLAG_LZO_COMPRESSED = 0x1 // records are LZO compressed FLAG_ANONYMIZED = 0x2 // flow data are anonimized FLAG_UNUSED = 0x4 // unused FLAG_BZ2_COMPRESSED = 0x8 // records are BZ2 compressed FLAG_LZ4_COMPRESSED = 0x10 // records are LZ4 compressed COMPRESSION_MASK = 0x19 // all compression bits )
View Source
const BZ2_COMPRESSED = 2
View Source
const EXasRoutingID = uint16(0x7)
View Source
const EXcntFlowID = uint16(0x5)
View Source
const EXflowMiscID = uint16(0x4)
View Source
const EXgenericFlowID = uint16(0x1)
View Source
const EXipv4FlowID = uint16(0x2)
View Source
const EXipv6FlowID = uint16(0x3)
View Source
const EXnull = uint(0x0)
View Source
const EXvLanID = uint16(0x6)
View Source
const LZ4_COMPRESSED = 3
View Source
const LZO_COMPRESSED = 1
View Source
const MAXEXTENSIONS = uint16(0x26)
View Source
const NOT_COMPRESSED = 0
View Source
const TYPE_IDENT = 0x8001
View Source
const TYPE_STAT = 0x8002
View Source
const V3Record = uint16(0xb)
View Source
const V3_FLAG_ANON = uint(0x4)
View Source
const V3_FLAG_EVENT = uint(0x1)
View Source
const V3_FLAG_SAMPLED = uint(0x2)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataBlock ¶
type DataBlock struct {
Header DataBlockHeader
Data []byte
}
type DataBlockHeader ¶
type EXasRouting ¶
type EXflowMisc ¶
type EXgenericFlow ¶
type FlowRecordV3 ¶
type FlowRecordV3 struct {
// contains filtered or unexported fields
}
func NewRecord ¶
func NewRecord(record []byte) *FlowRecordV3
Extract next flow record from []byte stream
func (*FlowRecordV3) AsRouting ¶
func (flowRecord *FlowRecordV3) AsRouting() *EXasRouting
Return asRouting extension
func (*FlowRecordV3) CntFlow ¶
func (flowRecord *FlowRecordV3) CntFlow() *EXcntFlow
Return out counter extension
func (*FlowRecordV3) FlowMisc ¶
func (flowRecord *FlowRecordV3) FlowMisc() *EXflowMisc
Return misc extension
func (*FlowRecordV3) GenericFlow ¶
func (flowRecord *FlowRecordV3) GenericFlow() *EXgenericFlow
Return generic extension
func (*FlowRecordV3) IP ¶
func (flowRecord *FlowRecordV3) IP() *EXip
Return IP extension IPv4 or IPv6
func (*FlowRecordV3) String ¶
func (flowRecord *FlowRecordV3) String() string
Return string for %v Printf()
type NfFile ¶
type NfFile struct {
Header NfFileHeader
StatRecord StatRecord
// contains filtered or unexported fields
}
func (*NfFile) AllRecords ¶
func (nfFile *NfFile) AllRecords() (chan *FlowRecordV3, error)
AllRecord takes an NfFile object and returns a channel of FlowRecordV3 it reads and uncompresses the data blocks with ReadDataBlocks Iterating over the channel reads all flow records
func (*NfFile) ReadDataBlocks ¶
ReadDataBlocks iterates over the underlaying file and decompresses the data blocks A channel with all uncompressed data blocks is returned.
func (*NfFile) Stat ¶
func (nfFile *NfFile) Stat() StatRecord
Stat returns the stat record of the current NfFile object
type NfFileHeader ¶
type NfFileHeader struct {
Magic uint16 // magic 0xA50C to recognize nfdump file type and endian type
Version uint16 // version of binary file layout. Valid: version 2
NfVersion uint32 // version of nfdump created this file
Created uint64 // file creat time
Compression uint8 // type of compression
// NOT_COMPRESSED 0
// LZO_COMPRESSED 1
// BZ2_COMPRESSED 2
// LZ4_COMPRESSED 3
Encryption uint8 // type of encryption
// NOT_ENCRYPTED 0
AppendixBlocks uint16 // number of blocks to read from appendix
Unused uint32 // unused. must be 0
OffAppendix uint64 // // offset in file for appendix blocks with additional data
BlockSize uint32 // max block size of a data block
NumBlocks uint32 // number of data blocks in file
}
type NfFileHeaderV1 ¶
type StatRecord ¶
type StatRecord struct {
// overall stat
Numflows uint64
Numbytes uint64
Numpackets uint64
// flow stat
NumflowsTcp uint64
NumflowsUdp uint64
NumflowsIcmp uint64
NumflowsOther uint64
// bytes stat
NumbytesTcp uint64
NumbytesUdp uint64
NumbytesIcmp uint64
NumbytesOther uint64
// packet stat
NumpacketsTcp uint64
NumpacketsUdp uint64
NumpacketsIcmp uint64
NumpacketsOther uint64
// time window
FirstSeen uint64
LastSeen uint64
// other
SequenceFailure uint64
}
Click to show internal directories.
Click to hide internal directories.