flows

package
v5.6.15+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SizeEthAddr    = 6
	SizeVlan       = 2
	SizeIPv4Addr   = 4
	SizeIPv6Addr   = 16
	SizeICMPID     = 2
	SizePortNumber = 2

	SizeEthFlowID    = 2 * SizeEthAddr    // source + dest mac address
	SizeVlanFlowID   = SizeVlan           // raw vlan id
	SizeIPv4FlowID   = 2 * SizeIPv4Addr   // source + dest ip
	SizeIPv6FlowID   = 2 * SizeIPv6Addr   // source + dest ip
	SizeICMPFlowID   = SizeICMPID         // icmp identifier (if present)
	SizeTCPFlowID    = 2 * SizePortNumber // source + dest port
	SizeUDPFlowID    = 2 * SizePortNumber // source + dest port
	SizeConnectionID = 8                  // 64bit internal connection id

	SizeFlowIDMax int = SizeEthFlowID +
		2*(SizeVlanFlowID+SizeIPv4FlowID+SizeIPv6FlowID) +
		SizeICMPFlowID +
		SizeTCPFlowID +
		SizeUDPFlowID +
		SizeConnectionID
)

Variables

View Source
var (
	ErrInvalidTimeout = errors.New("timeout must not >= 1s")
	ErrInvalidPeriod  = errors.New("report period must be -1 or >= 1s")
)

Functions

func FlowIDsEqual

func FlowIDsEqual(f1, f2 *FlowID) bool

Types

type Float

type Float struct {
	// contains filtered or unexported fields
}

func (*Float) Add

func (c *Float) Add(f *Flow, delta float64)

func (*Float) Set

func (c *Float) Set(f *Flow, value float64)

type Flow

type Flow struct {
	// contains filtered or unexported fields
}

type FlowID

type FlowID struct {
	// contains filtered or unexported fields
}

func (*FlowID) AddConnectionID

func (f *FlowID) AddConnectionID(id uint64)

func (*FlowID) AddEth

func (f *FlowID) AddEth(src, dst net.HardwareAddr)

func (*FlowID) AddICMPv4Request

func (f *FlowID) AddICMPv4Request(id uint16)

func (*FlowID) AddICMPv4Response

func (f *FlowID) AddICMPv4Response(id uint16)

func (*FlowID) AddICMPv6Request

func (f *FlowID) AddICMPv6Request(id uint16)

func (*FlowID) AddICMPv6Response

func (f *FlowID) AddICMPv6Response(id uint16)

func (*FlowID) AddIPv4

func (f *FlowID) AddIPv4(src, dst net.IP)

func (*FlowID) AddIPv6

func (f *FlowID) AddIPv6(src, dst net.IP)

func (*FlowID) AddTCP

func (f *FlowID) AddTCP(src, dst uint16)

func (*FlowID) AddUDP

func (f *FlowID) AddUDP(src, dst uint16)

func (*FlowID) AddVLan

func (f *FlowID) AddVLan(id uint16)

func (*FlowID) ConnectionID

func (f *FlowID) ConnectionID() []byte

func (*FlowID) Eth

func (f *FlowID) Eth() []byte

func (FlowID) EthAddr

func (f FlowID) EthAddr() ([]byte, []byte, bool)

func (*FlowID) Flags

func (f *FlowID) Flags() FlowIDFlag

func (*FlowID) Get

func (f *FlowID) Get(i FlowIDFlag) []byte

func (*FlowID) ICMPv4

func (f *FlowID) ICMPv4() []byte

func (*FlowID) ICMPv6

func (f *FlowID) ICMPv6() []byte

func (*FlowID) IPv4

func (f *FlowID) IPv4() []byte

func (*FlowID) IPv4Addr

func (f *FlowID) IPv4Addr() ([]byte, []byte, bool)

func (*FlowID) IPv6

func (f *FlowID) IPv6() []byte

func (*FlowID) IPv6Addr

func (f *FlowID) IPv6Addr() ([]byte, []byte, bool)

func (*FlowID) OutterIPv4

func (f *FlowID) OutterIPv4() []byte

func (*FlowID) OutterIPv4Addr

func (f *FlowID) OutterIPv4Addr() ([]byte, []byte, bool)

func (*FlowID) OutterIPv6

func (f *FlowID) OutterIPv6() []byte

func (*FlowID) OutterIPv6Addr

func (f *FlowID) OutterIPv6Addr() ([]byte, []byte, bool)

func (*FlowID) OutterVLan

func (f *FlowID) OutterVLan() []byte

func (*FlowID) Reset

func (f *FlowID) Reset(buf []byte)

func (*FlowID) Serialize

func (f *FlowID) Serialize() []byte

func (*FlowID) TCP

func (f *FlowID) TCP() []byte

func (*FlowID) TCPAddr

func (f *FlowID) TCPAddr() ([]byte, []byte, bool)

func (*FlowID) UDP

func (f *FlowID) UDP() []byte

func (*FlowID) UDPAddr

func (f *FlowID) UDPAddr() ([]byte, []byte, bool)

func (*FlowID) VLan

func (f *FlowID) VLan() []byte

type FlowIDFlag

type FlowIDFlag uint16
const (
	EthFlow FlowIDFlag = (1 << iota)
	OutterVlanFlow
	VLanFlow
	OutterIPv4Flow
	IPv4Flow
	OutterIPv6Flow
	IPv6Flow
	ICMPv4Flow
	ICMPv6Flow
	UDPFlow
	TCPFlow
	ConnectionID
)

type Flows

type Flows struct {
	// contains filtered or unexported fields
}

func NewFlows

func NewFlows(pub publish.Flows, config *config.Flows) (*Flows, error)

func (*Flows) Get

func (f *Flows) Get(id *FlowID) *Flow

func (*Flows) Lock

func (f *Flows) Lock()

func (*Flows) NewFloat

func (f *Flows) NewFloat(name string) (*Float, error)

func (*Flows) NewInt

func (f *Flows) NewInt(name string) (*Int, error)

func (*Flows) NewUint

func (f *Flows) NewUint(name string) (*Uint, error)

func (*Flows) Start

func (f *Flows) Start()

func (*Flows) Stop

func (f *Flows) Stop()

func (*Flows) Unlock

func (f *Flows) Unlock()

type Int

type Int struct {
	// contains filtered or unexported fields
}

func (*Int) Add

func (c *Int) Add(f *Flow, delta int64)

func (*Int) Set

func (c *Int) Set(f *Flow, value int64)

type Uint

type Uint struct {
	// contains filtered or unexported fields
}

func (*Uint) Add

func (c *Uint) Add(f *Flow, delta uint64)

func (*Uint) Set

func (c *Uint) Set(f *Flow, value uint64)

type Var

type Var interface{}

Jump to

Keyboard shortcuts

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