| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- 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
- 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)
- Disabled bool `json:"disabled"` // MikroTik 'X' flag
- Comment string `json:"comment,omitempty"`
- // 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"`
- }
|