package sdwan import "time" // SDWANMode represents the traffic distribution strategy. type SDWANMode string const ( ModeWeighted SDWANMode = "weighted" // Weighted percentage distribution across healthy links ModePCC SDWANMode = "pcc" // Per-Connection Classifier (flow hash stickiness) ModeLowestLatency SDWANMode = "lowest-latency" // Quality SLA: select link with minimum RTT ModeLowestLoss SDWANMode = "lowest-loss" // Quality SLA: select link with minimum packet loss ModeFailover SDWANMode = "failover" // Active-backup priority failover ) // MemberStatus represents the live health state of an SD-WAN member. type MemberStatus string const ( StatusHealthy MemberStatus = "HEALTHY" StatusDegraded MemberStatus = "DEGRADED" StatusDown MemberStatus = "DOWN" StatusDisabled MemberStatus = "DISABLED" ) // SDWANMember represents a single WAN link participating in an SD-WAN group. type SDWANMember struct { ID string `json:"id"` Interface string `json:"interface"` // Underlying device name, e.g. "eth0", "eth1", "aerotun0" Gateway string `json:"gateway"` // Next-hop IPv4 gateway for this link Weight int `json:"weight"` // Relative weight or percentage ratio (default: 50) Priority int `json:"priority"` // Priority for failover mode (1 = highest primary) TargetProbe string `json:"target_probe"` // Health check ping target IP (e.g. "1.1.1.1", "8.8.8.8") MaxLatency int `json:"max_latency"` // SLA maximum latency threshold in ms (default: 250) MaxLoss int `json:"max_loss"` // SLA maximum packet loss threshold in % (default: 20) Comment string `json:"comment,omitempty"` Disabled bool `json:"disabled"` // Live Telemetry from SLA Prober Status MemberStatus `json:"status"` // HEALTHY, DEGRADED, DOWN, DISABLED LiveLatency float64 `json:"live_latency"` // Latency in ms (RTT) PacketLoss float64 `json:"packet_loss"` // Packet loss percentage (0.0 - 100.0) Jitter float64 `json:"jitter"` // Latency jitter in ms LastChecked time.Time `json:"last_checked"` ConsecutiveFails int `json:"consecutive_fails"` // Counter for sequential probe failures ConsecutiveSuccesses int `json:"consecutive_successes"` // Counter for sequential probe successes TableID int `json:"table_id"` // Kernel routing table ID (e.g. 1101) MarkHex string `json:"mark_hex"` // Fwmark hex string (e.g. "0x5d01") MarkInt uint32 `json:"mark_int"` // Fwmark integer } // SDWANGroup represents a unified SD-WAN virtual interface / zone. type SDWANGroup struct { ID string `json:"id"` Name string `json:"name"` // Group name, e.g. "sdwan0", "sdwan-internet" Mode SDWANMode `json:"mode"` // "weighted", "pcc", "lowest-latency", "lowest-loss", "failover" HashFields string `json:"hash_fields"` // For PCC: "both-addresses-and-ports", "src-address", "both-addresses" AutoNAT bool `json:"auto_nat"` // Automatically masquerade egress traffic from member interfaces ProbeInterval int `json:"probe_interval"` // Health check frequency in seconds (default: 3) Comment string `json:"comment,omitempty"` Disabled bool `json:"disabled"` Running bool `json:"running"` Members []*SDWANMember `json:"members"` LastError string `json:"last_error,omitempty"` } // TelemetrySummary represents summary stats for all SD-WAN groups. type TelemetrySummary struct { TotalGroups int `json:"total_groups"` ActiveGroups int `json:"active_groups"` TotalMembers int `json:"total_members"` HealthyMembers int `json:"healthy_members"` DegradedMembers int `json:"degraded_members"` DownMembers int `json:"down_members"` }