Documentation ¶
Index ¶
- Constants
- Variables
- type AddressType
- type ContainsMetricData
- type EthHeader
- type FlowData
- type FlowFormatType
- type FlowRecord
- type Header
- type HeaderProtocolType
- type IPHeader
- type IPV4Header
- type IPV6Header
- type InterfaceFormatType
- type PacketDecoder
- type ProtocolHeader
- type RawPacketHeaderFlowData
- type SFlow
- type Sample
- type SampleData
- type SampleDataFlowSampleExpanded
- type SampleType
- type TCPHeader
- type UDPHeader
- type V5Format
Constants ¶
View Source
const ( AddressTypeIPv6 uint32 = 2 // sflow_version_5.txt line: 1384 AddressTypeIPv4 uint32 = 1 // sflow_version_5.txt line: 1383 IPProtocolTCP uint8 = 6 IPProtocolUDP uint8 = 17 )
Variables ¶
View Source
var ETypeMap = map[uint16]string{
0x0800: "IPv4",
0x86DD: "IPv6",
}
View Source
var HeaderProtocolMap = map[HeaderProtocolType]string{ HeaderProtocolTypeEthernetISO88023: "ETHERNET-ISO88023", }
View Source
var IPvMap = map[uint32]string{
1: "IPV4",
2: "IPV6",
}
Functions ¶
This section is empty.
Types ¶
type AddressType ¶
type AddressType uint32 // must be uint32
const ( AddressTypeUnknown AddressType = 0 AddressTypeIPV4 AddressType = 1 AddressTypeIPV6 AddressType = 2 )
type ContainsMetricData ¶
type EthHeader ¶
type FlowData ¶
type FlowData ContainsMetricData
type FlowFormatType ¶
type FlowFormatType uint32
const (
FlowFormatTypeRawPacketHeader FlowFormatType = 1 // sflow_version_5.txt line: 1938
)
type FlowRecord ¶
type FlowRecord struct { FlowFormat FlowFormatType FlowData FlowData }
type Header ¶
type Header ContainsMetricData
type HeaderProtocolType ¶
type HeaderProtocolType uint32
const ( HeaderProtocolTypeEthernetISO88023 HeaderProtocolType = 1 HeaderProtocolTypeISO88024TokenBus HeaderProtocolType = 2 HeaderProtocolTypeISO88025TokenRing HeaderProtocolType = 3 HeaderProtocolTypeFDDI HeaderProtocolType = 4 HeaderProtocolTypeFrameRelay HeaderProtocolType = 5 HeaderProtocolTypeX25 HeaderProtocolType = 6 HeaderProtocolTypePPP HeaderProtocolType = 7 HeaderProtocolTypeSMDS HeaderProtocolType = 8 HeaderProtocolTypeAAL5 HeaderProtocolType = 9 HeaderProtocolTypeAAL5IP HeaderProtocolType = 10 /* e.g. Cisco AAL5 mux */ HeaderProtocolTypeIPv4 HeaderProtocolType = 11 HeaderProtocolTypeIPv6 HeaderProtocolType = 12 HeaderProtocolTypeMPLS HeaderProtocolType = 13 HeaderProtocolTypePOS HeaderProtocolType = 14 /* RFC 1662, 2615 */ )
type IPHeader ¶
type IPHeader ContainsMetricData
type IPV4Header ¶
type IPV4Header struct { Version uint8 // 4 bit InternetHeaderLength uint8 // 4 bit DSCP uint8 ECN uint8 TotalLength uint16 Identification uint16 Flags uint8 FragmentOffset uint16 TTL uint8 Protocol uint8 // https://en.wikipedia.org/wiki/List_of_IP_protocol_numbers HeaderChecksum uint16 SourceIP [4]byte DestIP [4]byte ProtocolHeader ProtocolHeader }
https://en.wikipedia.org/wiki/IPv4#Header
func (IPV4Header) GetFields ¶
func (h IPV4Header) GetFields() map[string]interface{}
func (IPV4Header) GetTags ¶
func (h IPV4Header) GetTags() map[string]string
type IPV6Header ¶
type IPV6Header struct { DSCP uint8 ECN uint8 PayloadLength uint16 NextHeaderProto uint8 // tcp/udp? HopLimit uint8 SourceIP [16]byte DestIP [16]byte ProtocolHeader ProtocolHeader }
https://en.wikipedia.org/wiki/IPv6_packet
func (IPV6Header) GetFields ¶
func (h IPV6Header) GetFields() map[string]interface{}
func (IPV6Header) GetTags ¶
func (h IPV6Header) GetTags() map[string]string
type InterfaceFormatType ¶
type InterfaceFormatType uint8 // sflow_version_5.txt line 1497
const ( InterfaceFormatTypeSingleInterface InterfaceFormatType = 0 InterfaceFormatTypePacketDiscarded InterfaceFormatType = 1 )
type PacketDecoder ¶
func NewDecoder ¶
func NewDecoder() *PacketDecoder
func (*PacketDecoder) DecodeOnePacket ¶
func (d *PacketDecoder) DecodeOnePacket(r io.Reader) (*V5Format, error)
func (*PacketDecoder) OnPacket ¶
func (d *PacketDecoder) OnPacket(f func(p *V5Format))
type ProtocolHeader ¶
type ProtocolHeader ContainsMetricData
type RawPacketHeaderFlowData ¶
type RawPacketHeaderFlowData struct { HeaderProtocol HeaderProtocolType FrameLength uint32 Bytes uint32 StrippedOctets uint32 HeaderLength uint32 Header Header }
func (RawPacketHeaderFlowData) GetFields ¶
func (h RawPacketHeaderFlowData) GetFields() map[string]interface{}
func (RawPacketHeaderFlowData) GetTags ¶
func (h RawPacketHeaderFlowData) GetTags() map[string]string
type SFlow ¶
type SFlow struct { ServiceAddress string `toml:"service_address"` ReadBufferSize internal.Size `toml:"read_buffer_size"` Log cua.Logger `toml:"-"` // contains filtered or unexported fields }
func (*SFlow) Description ¶
Description answers a description of this input plugin
func (*SFlow) Gather ¶
Gather is a NOOP for sFlow as it receives, asynchronously, sFlow network packets
func (*SFlow) SampleConfig ¶
SampleConfig answers a sample configuration
type Sample ¶
type Sample struct { SampleType SampleType SampleData SampleDataFlowSampleExpanded }
type SampleData ¶
type SampleData interface{}
type SampleDataFlowSampleExpanded ¶
type SampleDataFlowSampleExpanded struct { SequenceNumber uint32 SourceIDType uint32 SourceIDIndex uint32 SamplingRate uint32 SamplePool uint32 Drops uint32 SampleDirection string // ingress/egress InputIfFormat uint32 InputIfIndex uint32 OutputIfFormat uint32 OutputIfIndex uint32 FlowRecords []FlowRecord }
type SampleType ¶
type SampleType uint32
const ( SampleTypeFlowSample SampleType = 1 // sflow_version_5.txt line: 1614 SampleTypeFlowSampleExpanded SampleType = 3 // sflow_version_5.txt line: 1698 )
type TCPHeader ¶
type V5Format ¶
type V5Format struct { Version uint32 AgentAddress net.IPAddr SubAgentID uint32 SequenceNumber uint32 Uptime uint32 Samples []Sample }
V5Format answers and decoder.Directive capable of decoding sFlow v5 packets in accordance with SFlow v5 specification at https://sflow.org/sflow_version_5.txt
Click to show internal directories.
Click to hide internal directories.