sflow

package
v2.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: BSD-3-Clause Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	FORMAT_EXT_SWITCH  = 1001
	FORMAT_EXT_ROUTER  = 1002
	FORMAT_EXT_GATEWAY = 1003
	FORMAT_RAW_PKT     = 1
	FORMAT_ETH         = 2
	FORMAT_IPV4        = 3
	FORMAT_IPV6        = 4
)

Variables

This section is empty.

Functions

func DecodeIP

func DecodeIP(payload *bytes.Buffer) (uint32, []byte, error)

func DecodeMessage

func DecodeMessage(payload *bytes.Buffer, packetV5 *Packet) error

func DecodeMessageVersion

func DecodeMessageVersion(payload *bytes.Buffer, packetV5 *Packet) error

func DecodeSample

func DecodeSample(header *SampleHeader, payload *bytes.Buffer) (interface{}, error)

Types

type CounterRecord

type CounterRecord struct {
	Header RecordHeader `json:"header"`
	Data   interface{}  `json:"data"`
}

func DecodeCounterRecord

func DecodeCounterRecord(header *RecordHeader, payload *bytes.Buffer) (CounterRecord, error)

type CounterSample

type CounterSample struct {
	Header SampleHeader `json:"header"`

	CounterRecordsCount uint32          `json:"counter-records-count"`
	Records             []CounterRecord `json:"records"`
}

type DecoderError

type DecoderError struct {
	Err error
}

func (*DecoderError) Error

func (e *DecoderError) Error() string

func (*DecoderError) Unwrap

func (e *DecoderError) Unwrap() error

type EthernetCounters

type EthernetCounters struct {
	Dot3StatsAlignmentErrors           uint32 `json:"dot3-stats-aligment-errors"`
	Dot3StatsFCSErrors                 uint32 `json:"dot3-stats-fcse-errors"`
	Dot3StatsSingleCollisionFrames     uint32 `json:"dot3-stats-single-collision-frames"`
	Dot3StatsMultipleCollisionFrames   uint32 `json:"dot3-stats-multiple-collision-frames"`
	Dot3StatsSQETestErrors             uint32 `json:"dot3-stats-seq-test-errors"`
	Dot3StatsDeferredTransmissions     uint32 `json:"dot3-stats-deferred-transmissions"`
	Dot3StatsLateCollisions            uint32 `json:"dot3-stats-late-collisions"`
	Dot3StatsExcessiveCollisions       uint32 `json:"dot3-stats-excessive-collisions"`
	Dot3StatsInternalMacTransmitErrors uint32 `json:"dot3-stats-internal-mac-transmit-errors"`
	Dot3StatsCarrierSenseErrors        uint32 `json:"dot3-stats-carrier-sense-errors"`
	Dot3StatsFrameTooLongs             uint32 `json:"dot3-stats-frame-too-longs"`
	Dot3StatsInternalMacReceiveErrors  uint32 `json:"dot3-stats-internal-mac-receive-errors"`
	Dot3StatsSymbolErrors              uint32 `json:"dot3-stats-symbol-errors"`
}

type ExpandedFlowSample

type ExpandedFlowSample struct {
	Header SampleHeader `json:"header"`

	SamplingRate     uint32       `json:"sampling-rate"`
	SamplePool       uint32       `json:"sample-pool"`
	Drops            uint32       `json:"drops"`
	InputIfFormat    uint32       `json:"input-if-format"`
	InputIfValue     uint32       `json:"input-if-value"`
	OutputIfFormat   uint32       `json:"output-if-format"`
	OutputIfValue    uint32       `json:"output-if-value"`
	FlowRecordsCount uint32       `json:"flow-records-count"`
	Records          []FlowRecord `json:"records"`
}

type ExtendedGateway

type ExtendedGateway struct {
	NextHopIPVersion  uint32          `json:"next-hop-ip-version"`
	NextHop           utils.IPAddress `json:"next-hop"`
	AS                uint32          `json:"as"`
	SrcAS             uint32          `json:"src-as"`
	SrcPeerAS         uint32          `json:"src-peer-as"`
	ASDestinations    uint32          `json:"as-destinations"`
	ASPathType        uint32          `json:"as-path-type"`
	ASPathLength      uint32          `json:"as-path-length"`
	ASPath            []uint32        `json:"as-path"`
	CommunitiesLength uint32          `json:"communities-length"`
	Communities       []uint32        `json:"communities"`
	LocalPref         uint32          `json:"local-pref"`
}

type ExtendedRouter

type ExtendedRouter struct {
	NextHopIPVersion uint32          `json:"next-hop-ip-version"`
	NextHop          utils.IPAddress `json:"next-hop"`
	SrcMaskLen       uint32          `json:"src-mask-len"`
	DstMaskLen       uint32          `json:"dst-mask-len"`
}

type ExtendedSwitch

type ExtendedSwitch struct {
	SrcVlan     uint32 `json:"src-vlan"`
	SrcPriority uint32 `json:"src-priority"`
	DstVlan     uint32 `json:"dst-vlan"`
	DstPriority uint32 `json:"dst-priority"`
}

type FlowError

type FlowError struct {
	Format uint32
	Seq    uint32
	Err    error
}

func (*FlowError) Error

func (e *FlowError) Error() string

func (*FlowError) Unwrap

func (e *FlowError) Unwrap() error

type FlowRecord

type FlowRecord struct {
	Header RecordHeader `json:"header"`
	Data   interface{}  `json:"data"`
}

func DecodeFlowRecord

func DecodeFlowRecord(header *RecordHeader, payload *bytes.Buffer) (FlowRecord, error)

type FlowSample

type FlowSample struct {
	Header SampleHeader `json:"header"`

	SamplingRate     uint32       `json:"sampling-rate"`
	SamplePool       uint32       `json:"sample-pool"`
	Drops            uint32       `json:"drops"`
	Input            uint32       `json:"input"`
	Output           uint32       `json:"output"`
	FlowRecordsCount uint32       `json:"flow-records-count"`
	Records          []FlowRecord `json:"records"`
}

type IfCounters

type IfCounters struct {
	IfIndex            uint32 `json:"if-index"`
	IfType             uint32 `json:"if-type"`
	IfSpeed            uint64 `json:"if-speed"`
	IfDirection        uint32 `json:"if-direction"`
	IfStatus           uint32 `json:"if-status"`
	IfInOctets         uint64 `json:"if-in-octets"`
	IfInUcastPkts      uint32 `json:"if-in-ucast-pkts"`
	IfInMulticastPkts  uint32 `json:"if-in-multicast-pkts"`
	IfInBroadcastPkts  uint32 `json:"if-in-broadcast-pkts"`
	IfInDiscards       uint32 `json:"if-in-discards"`
	IfInErrors         uint32 `json:"if-in-errors"`
	IfInUnknownProtos  uint32 `json:"if-in-unknown-protos"`
	IfOutOctets        uint64 `json:"if-out-octets"`
	IfOutUcastPkts     uint32 `json:"if-out-ucast-pkts"`
	IfOutMulticastPkts uint32 `json:"if-out-multicast-pkts"`
	IfOutBroadcastPkts uint32 `json:"if-out-broadcast-pkts"`
	IfOutDiscards      uint32 `json:"if-out-discards"`
	IfOutErrors        uint32 `json:"if-out-errors"`
	IfPromiscuousMode  uint32 `json:"if-promiscuous-mode"`
}

type Packet

type Packet struct {
	Version        uint32          `json:"version"`
	IPVersion      uint32          `json:"ip-version"`
	AgentIP        utils.IPAddress `json:"agent-ip"`
	SubAgentId     uint32          `json:"sub-agent-id"`
	SequenceNumber uint32          `json:"sequence-number"`
	Uptime         uint32          `json:"uptime"`
	SamplesCount   uint32          `json:"samples-count"`
	Samples        []interface{}   `json:"samples"`
}

func (*Packet) MarshalJSON

func (p *Packet) MarshalJSON() ([]byte, error)

func (*Packet) MarshalText

func (p *Packet) MarshalText() ([]byte, error)

type RawRecord

type RawRecord struct {
	Data []byte `json:"data"`
}

type RecordError

type RecordError struct {
	DataFormat uint32
	Err        error
}

func (*RecordError) Error

func (e *RecordError) Error() string

func (*RecordError) Unwrap

func (e *RecordError) Unwrap() error

type RecordHeader

type RecordHeader struct {
	DataFormat uint32 `json:"data-format"`
	Length     uint32 `json:"length"`
}

type SampleHeader

type SampleHeader struct {
	Format uint32 `json:"format"`
	Length uint32 `json:"length"`

	SampleSequenceNumber uint32 `json:"sample-sequence-number"`
	SourceIdType         uint32 `json:"source-id-type"`
	SourceIdValue        uint32 `json:"source-id-value"`
}

type SampledEthernet

type SampledEthernet struct {
	Length  uint32           `json:"length"`
	SrcMac  utils.MacAddress `json:"src-mac"`
	DstMac  utils.MacAddress `json:"dst-mac"`
	EthType uint32           `json:"eth-type"`
}

type SampledHeader

type SampledHeader struct {
	Protocol       uint32 `json:"protocol"`
	FrameLength    uint32 `json:"frame-length"`
	Stripped       uint32 `json:"stripped"`
	OriginalLength uint32 `json:"original-length"`
	HeaderData     []byte `json:"header-data"`
}

type SampledIPBase

type SampledIPBase struct {
	Length   uint32          `json:"length"`
	Protocol uint32          `json:"protocol"`
	SrcIP    utils.IPAddress `json:"src-ip"`
	DstIP    utils.IPAddress `json:"dst-ip"`
	SrcPort  uint32          `json:"src-port"`
	DstPort  uint32          `json:"dst-port"`
	TcpFlags uint32          `json:"tcp-flags"`
}

type SampledIPv4

type SampledIPv4 struct {
	SampledIPBase
	Tos uint32 `json:"tos"`
}

type SampledIPv6

type SampledIPv6 struct {
	SampledIPBase
	Priority uint32 `json:"priority"`
}

Jump to

Keyboard shortcuts

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