Documentation
¶
Index ¶
- Constants
- func DecodeIP(payload *bytes.Buffer) (uint32, []byte, error)
- func DecodeMessage(payload *bytes.Buffer, packetV5 *Packet) error
- func DecodeMessageVersion(payload *bytes.Buffer, packetV5 *Packet) error
- func DecodeSample(header *SampleHeader, payload *bytes.Buffer) (interface{}, error)
- type CounterRecord
- type CounterSample
- type DecoderError
- type DropSample
- type EgressQueue
- type EthernetCounters
- type ExpandedFlowSample
- type ExtendedACL
- type ExtendedFunction
- type ExtendedGateway
- type ExtendedRouter
- type ExtendedSwitch
- type FlowError
- type FlowRecord
- type FlowSample
- type IfCounters
- type Packet
- type RawRecord
- type RecordError
- type RecordHeader
- type SampleHeader
- type SampledEthernet
- type SampledHeader
- type SampledIPBase
- type SampledIPv4
- type SampledIPv6
Constants ¶
View Source
const ( SAMPLE_FORMAT_FLOW = 1 SAMPLE_FORMAT_COUNTER = 2 SAMPLE_FORMAT_EXPANDED_FLOW = 3 SAMPLE_FORMAT_EXPANDED_COUNTER = 4 SAMPLE_FORMAT_DROP = 5 )
Opaque sample_data types according to https://sflow.org/SFLOW-DATAGRAM5.txt
View Source
const ( FLOW_TYPE_RAW = 1 FLOW_TYPE_ETH = 2 FLOW_TYPE_IPV4 = 3 FLOW_TYPE_IPV6 = 4 FLOW_TYPE_EXT_SWITCH = 1001 FLOW_TYPE_EXT_ROUTER = 1002 FLOW_TYPE_EXT_GATEWAY = 1003 FLOW_TYPE_EXT_USER = 1004 FLOW_TYPE_EXT_URL = 1005 FLOW_TYPE_EXT_MPLS = 1006 FLOW_TYPE_EXT_NAT = 1007 FLOW_TYPE_EXT_MPLS_TUNNEL = 1008 FLOW_TYPE_EXT_MPLS_VC = 1009 FLOW_TYPE_EXT_MPLS_FEC = 1010 FLOW_TYPE_EXT_MPLS_LVP_FEC = 1011 FLOW_TYPE_EXT_VLAN_TUNNEL = 1012 // According to https://sflow.org/sflow_drops.txt FLOW_TYPE_EGRESS_QUEUE = 1036 FLOW_TYPE_EXT_ACL = 1037 FLOW_TYPE_EXT_FUNCTION = 1038 )
Opaque flow_data types according to https://sflow.org/SFLOW-STRUCTS5.txt
View Source
const ( COUNTER_TYPE_IF = 1 COUNTER_TYPE_ETH = 2 COUNTER_TYPE_TOKENRING = 3 COUNTER_TYPE_VG = 4 COUNTER_TYPE_VLAN = 5 COUNTER_TYPE_CPU = 1001 )
Opaque counter_data types according to https://sflow.org/SFLOW-STRUCTS5.txt
Variables ¶
This section is empty.
Functions ¶
func DecodeMessageVersion ¶
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 DropSample ¶ added in v2.1.5
type DropSample struct { Header SampleHeader `json:"header"` Drops uint32 `json:"drops"` Input uint32 `json:"input"` Output uint32 `json:"output"` Reason uint32 `json:"reason"` FlowRecordsCount uint32 `json:"flow-records-count"` Records []FlowRecord `json:"records"` }
DropSample data structure according to https://sflow.org/sflow_drops.txt
type EgressQueue ¶ added in v2.1.5
type EgressQueue struct {
Queue uint32 `json:"queue"`
}
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 ExtendedACL ¶ added in v2.1.5
type ExtendedFunction ¶ added in v2.1.5
type ExtendedFunction struct {
Symbol string `json:"symbol"`
}
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 ExtendedSwitch ¶
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 (*Packet) MarshalText ¶
type RecordError ¶
func (*RecordError) Error ¶
func (e *RecordError) Error() string
func (*RecordError) Unwrap ¶
func (e *RecordError) Unwrap() error
type RecordHeader ¶
type SampleHeader ¶
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 SampledIPBase ¶
type SampledIPv4 ¶
type SampledIPv4 struct { SampledIPBase Tos uint32 `json:"tos"` }
type SampledIPv6 ¶
type SampledIPv6 struct { SampledIPBase Priority uint32 `json:"priority"` }
Click to show internal directories.
Click to hide internal directories.