IPFIX parser package for Go
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2018-02-19 19:27:15 +01:00
etc generate builtin dictionary from ipfix.xml 2015-03-12 12:30:25 +01:00
.gitignore generate builtin dictionary from ipfix.xml 2015-03-12 12:30:25 +01:00
benchmark_test.go Reduce allocations in interpretInto path 2017-03-29 13:21:05 +02:00
build.sh Refactor and simplify API 2015-02-25 09:59:00 +01:00
builtin-dictionary.go generate builtin dictionary from ipfix.xml 2015-03-12 12:30:25 +01:00
debug.go Add IPFIXDEBUG envvar 2015-09-02 10:05:26 +02:00
doc.go Update docs for parsing methods, PacketConn handling (fixes #11) 2017-06-02 13:43:34 +02:00
examples_test.go Cleanups 2015-03-04 22:10:58 +01:00
interpreter.go Added support for template ID aliasing 2017-06-27 13:59:26 +02:00
interpreter_test.go Handle reduced-size encoded integers (fixes #12) 2017-06-07 15:57:36 +02:00
Jenkinsfile Add Jenkinsfile 2017-06-07 18:04:45 +02:00
LICENSE LICENSE 2013-07-22 09:17:34 +02:00
parser.go Export & load templates (#20) 2018-02-19 19:27:15 +01:00
parser_fuzz.go Use new gcfg import path 2016-02-03 10:52:28 +01:00
parser_test.go Fix error check for Go 1.10 2018-02-11 15:13:52 +01:00
read.go Don't panic on corrupt header lengths 2015-08-25 14:02:41 +02:00
README.md Build badge 2017-06-14 22:30:44 +02:00
rfc5103.go generate builtin dictionary from ipfix.xml 2015-03-12 12:30:25 +01:00
rfc5103_test.go Correct biflowDirection field 2015-03-12 09:39:43 +01:00
slice.go Minor refactoring 2015-07-14 08:45:05 +02:00
slice_test.go Minor refactoring 2015-07-14 08:45:05 +02:00

ipfix

Package ipfix implements an IPFIX (RFC 5101) parser and interpreter.

Build & Test API Documentation MIT License

Input data from an io.Reader or a []byte is parsed and chunked into messages. Template management and the standard IPFIX types are implemented so a fully parsed data set can be produced. Vendor fields can be added at runtime.

Example

To read an IPFIX stream, create a Session and then use ParseBuffer to parse data coming from a single UDP packet or similar.

var conn net.PacketConn // from somewhere
buf := make([]byte, 65507) // maximum UDP payload length
s := ipfix.NewSession()
for {
    n, _, err := conn.ReadFrom(buf)
    // handle err
    msg, err := s.ParseBuffer(buf[:n])
    // handle msg and err
}

To interpret records for correct data types and field names, use an interpreter:

i := ipfix.NewInterpreter(s)
var fieldList []ipfix.InterpretedField
for _, rec := range msg.DataRecords {
    fieldList = i.InterpretInto(rec, fieldList[:cap(fieldList)])
    // handle the field list
}

To add a vendor field to the dictionary so that it will be resolved by Interpret, create a DictionaryEntry and call AddDictionaryEntry.

e := ipfix.DictionaryEntry{
    Name: "someVendorField",
    FieldId: 42,
    EnterpriseId: 123456,
    Type: ipfix.Int32
}
i.AddDictionaryEntry(e)

License

The MIT license.

Usage

See the documentation.