| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132 |
- package dynamicrouting
- // BGPInstance represents global BGP settings (/routing bgp instance)
- type BGPInstance struct {
- Enabled bool `json:"enabled"`
- AS uint32 `json:"as"`
- RouterID string `json:"router_id"`
- HoldTime int `json:"hold_time"` // Default 180
- KeepaliveTime int `json:"keepalive_time"` // Default 60
- RedistributeConnected bool `json:"redistribute_connected"`
- RedistributeStatic bool `json:"redistribute_static"`
- RedistributeOSPF bool `json:"redistribute_ospf"`
- Running bool `json:"running"`
- }
- // BGPPeer represents a BGP peer connection (/routing bgp connection / peer)
- type BGPPeer struct {
- ID string `json:"id"`
- Name string `json:"name"`
- RemoteAddress string `json:"remote_address"`
- RemoteAS uint32 `json:"remote_as"`
- LocalAddress string `json:"local_address,omitempty"`
- Multihop bool `json:"multihop"`
- NexthopSelf bool `json:"nexthop_self"`
- Passive bool `json:"passive"`
- Password string `json:"password,omitempty"`
- Disabled bool `json:"disabled"`
- Comment string `json:"comment,omitempty"`
- // Runtime telemetry
- State string `json:"state,omitempty"` // Established, Active, Connect, Idle
- Uptime string `json:"uptime,omitempty"`
- PrefixReceived int `json:"prefix_received"`
- PrefixSent int `json:"prefix_sent"`
- }
- // BGPNetwork represents an advertised network (/routing bgp network)
- type BGPNetwork struct {
- ID string `json:"id"`
- Network string `json:"network"` // CIDR, e.g. 10.200.0.0/24
- Disabled bool `json:"disabled"`
- Comment string `json:"comment,omitempty"`
- }
- // BGPRoute represents an active BGP route
- type BGPRoute struct {
- Prefix string `json:"prefix"`
- NextHop string `json:"next_hop"`
- Metric int `json:"metric"`
- Weight int `json:"weight"`
- Path string `json:"path"`
- Origin string `json:"origin"`
- Best bool `json:"best"`
- }
- // OSPFInstance represents global OSPF settings (/routing ospf instance)
- type OSPFInstance struct {
- Enabled bool `json:"enabled"`
- RouterID string `json:"router_id"`
- RedistributeConnected bool `json:"redistribute_connected"`
- RedistributeStatic bool `json:"redistribute_static"`
- RedistributeBGP bool `json:"redistribute_bgp"`
- DefaultMetric int `json:"default_metric"`
- Running bool `json:"running"`
- }
- // OSPFArea represents an OSPF area (/routing ospf area)
- type OSPFArea struct {
- ID string `json:"id"`
- Name string `json:"name"`
- AreaID string `json:"area_id"` // e.g. "0.0.0.0" or "0"
- AreaType string `json:"area_type"` // default, stub, nssa
- Comment string `json:"comment,omitempty"`
- }
- // OSPFInterface represents an OSPF network/interface template (/routing ospf interface-template)
- type OSPFInterface struct {
- ID string `json:"id"`
- Network string `json:"network"` // CIDR, e.g. "192.168.131.0/24"
- Area string `json:"area"` // Area ID e.g. "0.0.0.0"
- Interface string `json:"interface,omitempty"` // eth0, vlan10, wg0...
- Cost int `json:"cost"` // Metric, default 10
- Priority int `json:"priority"` // Default 1
- HelloInterval int `json:"hello_interval"` // Default 10
- DeadInterval int `json:"dead_interval"` // Default 40
- Passive bool `json:"passive"`
- AuthType string `json:"auth_type"` // none, simple, md5
- AuthKey string `json:"auth_key,omitempty"`
- Disabled bool `json:"disabled"`
- Comment string `json:"comment,omitempty"`
- }
- // OSPFNeighbor represents a live OSPF neighbor
- type OSPFNeighbor struct {
- NeighborID string `json:"neighbor_id"`
- Address string `json:"address"`
- Interface string `json:"interface"`
- Area string `json:"area"`
- State string `json:"state"` // Full/DR, Full/Backup, 2-Way...
- DeadTimer string `json:"dead_timer"`
- }
- // OSPFRoute represents an active OSPF route
- type OSPFRoute struct {
- Prefix string `json:"prefix"`
- RouteType string `json:"route_type"` // Intra-Area, Inter-Area, External
- Cost int `json:"cost"`
- Area string `json:"area"`
- NextHop string `json:"next_hop"`
- Interface string `json:"interface"`
- }
- // DynamicRoutingSummary aggregates status for dashboard & badges
- type DynamicRoutingSummary struct {
- BGPEnabled bool `json:"bgp_enabled"`
- BGPRunning bool `json:"bgp_running"`
- BGPPeerCount int `json:"bgp_peer_count"`
- BGPEstablishedCount int `json:"bgp_established_count"`
- OSPFEnabled bool `json:"ospf_enabled"`
- OSPFRunning bool `json:"ospf_running"`
- OSPFNeighborCount int `json:"ospf_neighbor_count"`
- OSPFAdjacentCount int `json:"ospf_adjacent_count"`
- }
- // DynamicConfig stores all dynamic routing data on disk
- type DynamicConfig struct {
- BGPInstance BGPInstance `json:"bgp_instance"`
- BGPPeers []BGPPeer `json:"bgp_peers"`
- BGPNetworks []BGPNetwork `json:"bgp_networks"`
- OSPFInstance OSPFInstance `json:"ospf_instance"`
- OSPFAreas []OSPFArea `json:"ospf_areas"`
- OSPFInterfaces []OSPFInterface `json:"ospf_interfaces"`
- }
|