translate

package
v0.0.0-...-852af10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FieldTypes = map[string]FieldType{
	"unsigned8":            Uint8,
	"unsigned16":           Uint16,
	"unsigned32":           Uint32,
	"unsigned64":           Uint64,
	"signed8":              Int8,
	"signed16":             Int16,
	"signed32":             Int32,
	"signed64":             Int64,
	"float32":              Float32,
	"float64":              Float64,
	"boolean":              Boolean,
	"macAddress":           MacAddress,
	"octetArray":           OctetArray,
	"string":               String,
	"dateTimeSeconds":      DateTimeSeconds,
	"dateTimeMilliseconds": DateTimeMilliseconds,
	"dateTimeMicroseconds": DateTimeMicroseconds,
	"dateTimeNanoseconds":  DateTimeNanoseconds,
	"ipv4Address":          Ipv4Address,
	"ipv6Address":          Ipv6Address,
}

FieldTypes are used in the InformationElementEntries map

Functions

func Bytes

func Bytes(bs []byte, t FieldType) interface{}

Bytes translates a byte string to a go native type.

Types

type FieldType

type FieldType uint8

FieldType is the IPFIX type of an Information Element ("Field").

const (
	Unknown FieldType = iota
	Uint8
	Uint16
	Uint32
	Uint64
	Int8
	Int16
	Int32
	Int64
	Float32
	Float64
	Boolean
	MacAddress
	OctetArray
	String
	DateTimeSeconds
	DateTimeMilliseconds
	DateTimeMicroseconds
	DateTimeNanoseconds
	Ipv4Address
	Ipv6Address
)

The available field types as defined by RFC 5102.

func (*FieldType) UnmarshalText

func (f *FieldType) UnmarshalText(bs []byte) error

UnmarshalText converts byte slice to FieldType

type InformationElementEntry

type InformationElementEntry struct {
	Name         string
	FieldID      uint16
	EnterpriseID uint32
	Type         FieldType
}

InformationElementEntry is an entry in the Information Element map.

type Key

type Key struct {
	EnterpriseID uint32
	FieldID      uint16
}

Key is the key of the Information Element map.

type Translate

type Translate struct {
	session.Session
	// contains filtered or unexported fields
}

Translate knows how to translate the raw bytes from a DataRecord into their actual values.

func NewTranslate

func NewTranslate(s session.Session) *Translate

NewTranslate creates a new session bound translator.

func (*Translate) Key

Key retrieves the Information Element entry for the given Key.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL