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:
@@ -126,6 +126,8 @@ func (s *Server) handleStatusJSON() http.HandlerFunc {
|
||||
IPv6Prefixes int `json:"ipv6_prefixes"`
|
||||
Peerings int `json:"peerings"`
|
||||
LiveRoutes int `json:"live_routes"`
|
||||
IPv4Routes int `json:"ipv4_routes"`
|
||||
IPv6Routes int `json:"ipv6_routes"`
|
||||
}
|
||||
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -191,6 +193,9 @@ func (s *Server) handleStatusJSON() http.HandlerFunc {
|
||||
|
||||
const bitsPerMegabit = 1000000.0
|
||||
|
||||
// Get detailed routing table stats
|
||||
rtStats := s.routingTable.GetDetailedStats()
|
||||
|
||||
stats := Stats{
|
||||
Uptime: uptime,
|
||||
TotalMessages: metrics.TotalMessages,
|
||||
@@ -203,7 +208,9 @@ func (s *Server) handleStatusJSON() http.HandlerFunc {
|
||||
IPv4Prefixes: dbStats.IPv4Prefixes,
|
||||
IPv6Prefixes: dbStats.IPv6Prefixes,
|
||||
Peerings: dbStats.Peerings,
|
||||
LiveRoutes: s.routingTable.Size(),
|
||||
LiveRoutes: rtStats.TotalRoutes,
|
||||
IPv4Routes: rtStats.IPv4Routes,
|
||||
IPv6Routes: rtStats.IPv6Routes,
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
@@ -233,6 +240,8 @@ func (s *Server) handleStats() http.HandlerFunc {
|
||||
IPv6Prefixes int `json:"ipv6_prefixes"`
|
||||
Peerings int `json:"peerings"`
|
||||
LiveRoutes int `json:"live_routes"`
|
||||
IPv4Routes int `json:"ipv4_routes"`
|
||||
IPv6Routes int `json:"ipv6_routes"`
|
||||
}
|
||||
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -291,6 +300,9 @@ func (s *Server) handleStats() http.HandlerFunc {
|
||||
|
||||
const bitsPerMegabit = 1000000.0
|
||||
|
||||
// Get detailed routing table stats
|
||||
rtStats := s.routingTable.GetDetailedStats()
|
||||
|
||||
stats := StatsResponse{
|
||||
Uptime: uptime,
|
||||
TotalMessages: metrics.TotalMessages,
|
||||
@@ -303,7 +315,9 @@ func (s *Server) handleStats() http.HandlerFunc {
|
||||
IPv4Prefixes: dbStats.IPv4Prefixes,
|
||||
IPv6Prefixes: dbStats.IPv6Prefixes,
|
||||
Peerings: dbStats.Peerings,
|
||||
LiveRoutes: s.routingTable.Size(),
|
||||
LiveRoutes: rtStats.TotalRoutes,
|
||||
IPv4Routes: rtStats.IPv4Routes,
|
||||
IPv6Routes: rtStats.IPv6Routes,
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
||||
Reference in New Issue
Block a user