sFlow (Sampled Flow) is an industry-standard protocol for monitoring network traffic. It provides a way to collect information about network flows, including packet capture, traffic statistics, and routing information. sFlow is widely supported by network device vendors and is used in various network monitoring and analytics tools.

func main() addr, _ := net.ResolveUDPAddr("udp", ":6343") conn, _ := net.ListenUDP("udp", addr) buf := make([]byte, 1500) for n, _, _ := conn.ReadFromUDP(buf) pkt, _ := sflow.DecodeDatagram(buf[:n]) for _, sample := range pkt.Samples switch sample.Type() case sflow.TypeFlowSample: fs := sample.(sflow.FlowSample) fmt.Printf("Flow: %v bytes (sampled)\n", fs.Length) // Normalize & export case sflow.TypeCounterSample: cs := sample.(sflow.CounterSample) fmt.Printf("Counter: iface %d -> %d bytes\n", cs.IfIndex, cs.IfInOctets)

| Collector | Language | Strengths | Weaknesses | |-----------|----------|-----------|-------------| | | C | Reference implementation, raw decode | No built-in storage | | pmacct | C | MySQL/ClickHouse integration, BGP-aware | Complex config | | GoFlow2 | Go | Kafka/Redis output, gRPC, high throughput | Primarily NetFlow/IPFIX, sFlow plugin | | FlowMeter (self-contained) | Rust | Memory-safe, async UDP, Prometheus metrics | Less mature |