flowtrack

package
v1.22.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: BSD-3-Clause Imports: 4 Imported by: 4 modules, 9 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package flowtrack contains types for tracking TCP/UDP flows by 4-tuples.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// MaxEntries is the maximum number of cache entries before
	// an item is evicted. Zero means no limit.
	MaxEntries int
	// contains filtered or unexported fields
}

Cache is an LRU cache keyed by Tuple.

The zero value is valid to use.

It is not safe for concurrent access.

func (*Cache) Add

func (c *Cache) Add(key Tuple, value interface{})

Add adds a value to the cache, set or updating its associated value.

If MaxEntries is non-zero and the length of the cache is greater after any addition, the least recently used value is evicted.

func (*Cache) Get

func (c *Cache) Get(key Tuple) (value interface{}, ok bool)

Get looks up a key's value from the cache, also reporting whether it was present.

func (*Cache) Len

func (c *Cache) Len() int

Len returns the number of items in the cache.

func (*Cache) Remove

func (c *Cache) Remove(key Tuple)

Remove removes the provided key from the cache if it was present.

func (*Cache) RemoveOldest

func (c *Cache) RemoveOldest()

RemoveOldest removes the oldest item from the cache, if any.

type Tuple

type Tuple struct {
	Proto ipproto.Proto
	Src   netaddr.IPPort
	Dst   netaddr.IPPort
}

Tuple is a 5-tuple of proto, source and destination IP and port.

func (Tuple) String

func (t Tuple) String() string

Jump to

Keyboard shortcuts

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