Documentation ¶
Index ¶
Constants ¶
const IPv6Type = 0x86DD
IPv6Type value as defined in IEEE 802: https://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.xhtml
const MacLen = 6
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Accounter ¶
type Accounter struct {
// contains filtered or unexported fields
}
Accounter accumulates flows metrics in memory and eventually evicts them via an evictor channel. It is not safe for concurrent access so if at some point you need to parallelize also the accounting process you should either: (1) reimplement the Accounter by using a concurrent map implementation and performing the properties operations atomically; or (2) spinup parallel accounters that evict the flow records to another accounter that consolidates data from all (some kind of map-reduce).
func NewAccounter ¶
NewAccounter creates a new Accounter. The cache has no limit and it's assumed that eviction is done by the caller.
type HumanBytes ¶
type HumanBytes uint64
type IPAddr ¶ added in v0.1.1
IPAddr encodes v4 and v6 IPs with a fixed length. IPv4 addresses are encoded as IPv6 addresses with prefix ::ffff/96 as described in https://datatracker.ietf.org/doc/html/rfc4038#section-4.2 (same behavior as Go's net.IP type)
func (*IPAddr) IntEncodeV4 ¶ added in v0.1.1
IntEncodeV4 encodes an IPv4 address as an integer (in network encoding, big endian). It assumes that the passed IP is already IPv4. Otherwise it would just encode the last 4 bytes of an IPv6 address
func (*IPAddr) MarshalJSON ¶ added in v0.1.1
type MacAddr ¶
func (*MacAddr) MarshalJSON ¶
type Record ¶
type Record struct { TimeFlowStart time.Time TimeFlowEnd time.Time Interface string Packets int // contains filtered or unexported fields }
Record contains accumulated metrics from a flow