sflow

package
v0.0.0-...-6cd304b Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExtendedRouterData

type ExtendedRouterData struct {
	NextHopDestinationMask uint32
	NextHopSourceMask      uint32
	NextHop                net.IP
	AddressType            uint32
	FlowDataLength         uint32
	EnterpriseType         uint32
}

ExtendedRouterData represents sflow version 5 extended router data

type FlowSample

type FlowSample struct {
	FlowSampleHeader    *FlowSampleHeader
	RawPacketHeader     *RawPacketHeader
	RawPacketHeaderData unsafe.Pointer
	ExtendedRouterData  *ExtendedRouterData
}

FlowSample is an sflow version 5 flow sample

type FlowSampleHeader

type FlowSampleHeader struct {
	FlowRecord         uint32
	OutputIf           uint32
	InputIf            uint32
	DroppedPackets     uint32
	SamplePool         uint32
	SamplingRate       uint32
	SourceIDClassIndex uint32
	SequenceNumber     uint32
	SampleLength       uint32
	EnterpriseType     uint32
}

FlowSampleHeader is an sflow version 5 flow sample header

type Header struct {
	Version          uint32
	AgentAddressType uint32
	AgentAddress     net.IP
	SubAgentID       uint32
	SequenceNumber   uint32
	SysUpTime        uint32
	NumSamples       uint32
}

Header is an sflow version 5 header

type Packet

type Packet struct {
	// A pointer to the packets headers
	Header *Header

	// A slice of pointers to FlowSet. Each element is instance of (Data)FlowSet
	FlowSamples []*FlowSample

	// Buffer is a slice pointing to the original byte array that this packet was decoded from.
	// This field is only populated if debug level is at least 2
	Buffer []byte
	// contains filtered or unexported fields
}

Packet is a decoded representation of a single sflow UDP packet.

func Decode

func Decode(raw []byte, remote net.IP) (*Packet, error)

Decode is the main function of this package. It converts raw packet bytes to Packet struct.

type RawPacketHeader

type RawPacketHeader struct {
	OriginalPacketLength uint32
	PayloadRemoved       uint32
	FrameLength          uint32
	HeaderProtocol       uint32
	FlowDataLength       uint32
	EnterpriseType       uint32
}

RawPacketHeader is a raw packet header

Jump to

Keyboard shortcuts

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