Skip to content
This repository was archived by the owner on Nov 27, 2018. It is now read-only.
/ ipfix Public archive

IPFIX parser package for Go

License

Notifications You must be signed in to change notification settings

calmh/ipfix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

79a311d · Feb 19, 2018
Mar 12, 2015
Mar 12, 2015
Jun 7, 2017
Jul 22, 2013
Jun 14, 2017
Mar 29, 2017
Feb 25, 2015
Mar 12, 2015
Sep 2, 2015
Jun 2, 2017
Mar 4, 2015
Jun 27, 2017
Jun 7, 2017
Feb 19, 2018
Feb 3, 2016
Feb 11, 2018
Aug 25, 2015
Mar 12, 2015
Mar 12, 2015
Jul 14, 2015
Jul 14, 2015

Repository files navigation

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.

About

IPFIX parser package for Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages