1
0
mirror of https://github.com/netsampler/goflow2.git synced 2024-05-06 15:54:52 +00:00

72 lines
2.2 KiB
Go
Raw Permalink Normal View History

2021-05-22 16:12:26 -07:00
package sflow
import "github.com/netsampler/goflow2/v2/decoders/utils"
2023-08-09 19:47:20 -07:00
2021-05-22 16:12:26 -07:00
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"`
2021-05-22 16:12:26 -07:00
}
type SampleHeader struct {
2023-08-09 19:47:20 -07:00
Format uint32 `json:"format"`
Length uint32 `json:"length"`
2021-05-22 16:12:26 -07:00
2023-08-09 19:47:20 -07:00
SampleSequenceNumber uint32 `json:"sample-sequence-number"`
SourceIdType uint32 `json:"source-id-type"`
SourceIdValue uint32 `json:"source-id-value"`
2021-05-22 16:12:26 -07:00
}
type FlowSample struct {
2023-08-09 19:47:20 -07:00
Header SampleHeader `json:"header"`
2021-05-22 16:12:26 -07:00
2023-08-09 19:47:20 -07:00
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"`
2021-05-22 16:12:26 -07:00
}
type CounterSample struct {
2023-08-09 19:47:20 -07:00
Header SampleHeader `json:"header"`
2021-05-22 16:12:26 -07:00
2023-08-09 19:47:20 -07:00
CounterRecordsCount uint32 `json:"counter-records-count"`
Records []CounterRecord `json:"records"`
2021-05-22 16:12:26 -07:00
}
type ExpandedFlowSample struct {
2023-08-09 19:47:20 -07:00
Header SampleHeader `json:"header"`
2021-05-22 16:12:26 -07:00
2023-08-09 19:47:20 -07:00
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"`
2021-05-22 16:12:26 -07:00
}
type RecordHeader struct {
2023-08-09 19:47:20 -07:00
DataFormat uint32 `json:"data-format"`
Length uint32 `json:"length"`
2021-05-22 16:12:26 -07:00
}
type FlowRecord struct {
2023-08-09 19:47:20 -07:00
Header RecordHeader `json:"header"`
Data interface{} `json:"data"`
}
2021-05-22 16:12:26 -07:00
type CounterRecord struct {
2023-08-09 19:47:20 -07:00
Header RecordHeader `json:"header"`
Data interface{} `json:"data"`
2021-05-22 16:12:26 -07:00
}