package routing // RouteItem represents a MikroTik-style /ip route entry type RouteItem struct { ID string `json:"id"` DstAddress string `json:"dst_address"` // CIDR e.g. "0.0.0.0/0", "192.168.10.0/24" Gateway string `json:"gateway"` // Gateway IP e.g. "192.168.1.1" or interface "wg0" Interface string `json:"interface"` // Output device Distance int `json:"distance"` // Metric / Administrative Distance Protocol string `json:"protocol,omitempty"` // Protocol e.g. "bgp", "ospf", "static", "connected", "dhcp" RoutingTable string `json:"routing_table"` // Table name e.g. "main", "wan2", "vpn_out" TableID int `json:"table_id"` Active bool `json:"active"` // MikroTik 'A' flag Dynamic bool `json:"dynamic"` // MikroTik 'D' flag (kernel learned) Connect bool `json:"connect"` // MikroTik 'C' flag (directly connected interface subnet) Static bool `json:"static"` // MikroTik 'S' flag (user defined) ECMP bool `json:"ecmp"` // Equal-Cost Multi-Path route (MikroTik 'E' flag) Multicast bool `json:"multicast"` // Multicast / IGMP route (224.0.0.0/4 or kernel multicast) IsMultiPath bool `json:"is_multipath"` // Linux kernel multipath nexthop Disabled bool `json:"disabled"` // MikroTik 'X' flag Comment string `json:"comment,omitempty"` // Gateway Health Check & Behind-NAT Internet Prober CheckGateway string `json:"check_gateway,omitempty"` // "none", "ping", "internet" CheckTarget string `json:"check_target,omitempty"` // Target to probe (e.g. "1.1.1.1", "8.8.8.8") CheckInterval int `json:"check_interval,omitempty"` // Seconds between probes (default 5) CheckThreshold int `json:"check_threshold,omitempty"` // Consecutive failures before failover (default 3) HealthStatus string `json:"health_status,omitempty"` // "online", "offline", "checking", "none" HealthRTT float64 `json:"health_rtt_ms,omitempty"` // Round trip latency in ms HealthLossPct float64 `json:"health_loss_pct,omitempty"` // Packet loss percentage HealthFailCount int `json:"health_fail_count,omitempty"` // Consecutive failures count HealthLastCheck string `json:"health_last_check,omitempty"` // Formatted timestamp of last probe // Old values for modifying existing routes OldDstAddress string `json:"old_dst_address,omitempty"` OldGateway string `json:"old_gateway,omitempty"` OldRoutingTable string `json:"old_routing_table,omitempty"` OldDistance *int `json:"old_distance,omitempty"` OldInterface string `json:"old_interface,omitempty"` } // PolicyRuleItem represents a MikroTik /ip route rule (Linux `ip rule`) type PolicyRuleItem struct { ID string `json:"id"` Priority int `json:"priority"` // Preference number (e.g. 1000, 32766) SrcAddress string `json:"src_address,omitempty"` DstAddress string `json:"dst_address,omitempty"` RoutingMark string `json:"routing_mark,omitempty"` // Matches fwmark set in Mangle Table string `json:"table"` // Table to lookup (e.g. "wan2", "main") TableID int `json:"table_id"` Action string `json:"action"` // lookup, unreachable, blackhole, prohibit Comment string `json:"comment,omitempty"` IsDefault bool `json:"is_default,omitempty"` IsSystem bool `json:"is_system,omitempty"` } // RoutingTableItem represents a named routing table in Linux (/etc/iproute2/rt_tables) type RoutingTableItem struct { Name string `json:"name"` TableID int `json:"table_id"` Comment string `json:"comment,omitempty"` }