Add AS peers display to AS detail page
- Added GetASPeers method to database to fetch all peering relationships - Updated AS detail handler to fetch and pass peers to template - Added peers section to AS detail page showing all peer ASNs with their info - Added peer count to the info cards at the top of the page - Shows handle, description, and first/last seen dates for each peer
This commit is contained in:
@@ -493,6 +493,14 @@ func (s *Server) handleASDetail() http.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
// Get peers
|
||||
peers, err := s.db.GetASPeersContext(r.Context(), asn)
|
||||
if err != nil {
|
||||
s.logger.Error("Failed to get AS peers", "error", err)
|
||||
// Continue without peers rather than failing the whole request
|
||||
peers = []database.ASPeer{}
|
||||
}
|
||||
|
||||
// Group prefixes by IP version
|
||||
const ipVersionV4 = 4
|
||||
var ipv4Prefixes, ipv6Prefixes []database.LiveRoute
|
||||
@@ -549,6 +557,8 @@ func (s *Server) handleASDetail() http.HandlerFunc {
|
||||
TotalCount int
|
||||
IPv4Count int
|
||||
IPv6Count int
|
||||
Peers []database.ASPeer
|
||||
PeerCount int
|
||||
}{
|
||||
ASN: asInfo,
|
||||
IPv4Prefixes: ipv4Prefixes,
|
||||
@@ -556,6 +566,8 @@ func (s *Server) handleASDetail() http.HandlerFunc {
|
||||
TotalCount: len(prefixes),
|
||||
IPv4Count: len(ipv4Prefixes),
|
||||
IPv6Count: len(ipv6Prefixes),
|
||||
Peers: peers,
|
||||
PeerCount: len(peers),
|
||||
}
|
||||
|
||||
// Check if context is still valid before writing response
|
||||
|
||||
Reference in New Issue
Block a user