Files
yoloyolo/classify/types.go
T
gurix 15e8143389 feat(01-01): install Go 1.24, initialize module, create shared types
- Initialize Go module github.com/netsynth/netsynth with Go 1.24.1
- Create classify/types.go with 11 TrafficClass constants (ICMP, DNS, HTTPS,
  HTTP, SSH, SMTP, NTP, DHCP, other-TCP, other-UDP, unknown)
- Add ClassifiedPacket and WindowSnapshot shared types
- Add Phase 1 dependencies: gopacket v1.5.0, go-pcap, cobra v1.10.2
2026-03-25 12:11:02 +01:00

44 lines
1.3 KiB
Go

package classify
// TrafficClass represents a classified network traffic category.
type TrafficClass string
const (
ClassICMP TrafficClass = "ICMP"
ClassDNS TrafficClass = "DNS"
ClassHTTPS TrafficClass = "HTTPS"
ClassHTTP TrafficClass = "HTTP"
ClassSSH TrafficClass = "SSH"
ClassSMTP TrafficClass = "SMTP"
ClassNTP TrafficClass = "NTP"
ClassDHCP TrafficClass = "DHCP"
ClassOtherTCP TrafficClass = "other-TCP"
ClassOtherUDP TrafficClass = "other-UDP"
ClassUnknown TrafficClass = "unknown"
)
// AllClasses returns all known traffic classes in display order.
func AllClasses() []TrafficClass {
return []TrafficClass{
ClassICMP, ClassDNS, ClassHTTPS, ClassHTTP, ClassSSH,
ClassSMTP, ClassNTP, ClassDHCP, ClassOtherTCP, ClassOtherUDP, ClassUnknown,
}
}
// ClassifiedPacket pairs a raw packet's classification result with metadata.
type ClassifiedPacket struct {
Class TrafficClass
SrcPort uint16
DstPort uint16
Protocol string // "tcp", "udp", "icmp"
Length int
}
// WindowSnapshot holds aggregated packet counts for a time window.
// This is the contract between the aggregation stage and future audio synthesis (Phase 2).
type WindowSnapshot struct {
Counts map[TrafficClass]int64
TotalPackets int64
WindowIndex int
}