Add separate IPv4/IPv6 route counts to status page and API

- Update server Stats and StatsResponse structs to include ipv4_routes and ipv6_routes
- Fetch detailed routing table stats to get IPv4/IPv6 breakdown
- Add IPv4 Routes and IPv6 Routes display to HTML status page
- Change metric values to monospace font and remove bold styling
This commit is contained in:
2025-07-27 23:46:47 +02:00
parent 1d05372899
commit 283f2ddbf2
4 changed files with 288 additions and 3 deletions

View File

@@ -338,6 +338,28 @@ func (rt *RoutingTable) Clear() {
rt.lastMetricsReset = time.Now()
}
// RLock acquires a read lock on the routing table
// This is exposed for the snapshotter to use
func (rt *RoutingTable) RLock() {
rt.mu.RLock()
}
// RUnlock releases a read lock on the routing table
// This is exposed for the snapshotter to use
func (rt *RoutingTable) RUnlock() {
rt.mu.RUnlock()
}
// GetAllRoutesUnsafe returns all routes without copying
// IMPORTANT: Caller must hold RLock before calling this method
func (rt *RoutingTable) GetAllRoutesUnsafe() []*Route {
routes := make([]*Route, 0, len(rt.routes))
for _, route := range rt.routes {
routes = append(routes, route)
}
return routes
}
// Helper methods for index management
func (rt *RoutingTable) addToIndexes(key RouteKey, route *Route) {