- 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
270 lines
8.3 KiB
HTML
270 lines
8.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>AS{{.ASN.ASN}} - {{.ASN.Handle}} - RouteWatch</title>
|
|
<style>
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
margin: 0;
|
|
padding: 20px;
|
|
background: #f5f5f5;
|
|
color: #333;
|
|
}
|
|
.container {
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
background: white;
|
|
padding: 30px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
|
}
|
|
h1 {
|
|
margin: 0 0 10px 0;
|
|
color: #2c3e50;
|
|
}
|
|
.subtitle {
|
|
color: #7f8c8d;
|
|
margin-bottom: 30px;
|
|
}
|
|
.info-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
gap: 20px;
|
|
margin-bottom: 30px;
|
|
}
|
|
.info-card {
|
|
background: #f8f9fa;
|
|
padding: 20px;
|
|
border-radius: 6px;
|
|
border-left: 4px solid #3498db;
|
|
}
|
|
.info-label {
|
|
font-size: 14px;
|
|
color: #7f8c8d;
|
|
margin-bottom: 5px;
|
|
}
|
|
.info-value {
|
|
font-size: 24px;
|
|
font-weight: bold;
|
|
color: #2c3e50;
|
|
}
|
|
.prefix-section {
|
|
margin-top: 30px;
|
|
}
|
|
.prefix-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 20px;
|
|
}
|
|
.prefix-header h2 {
|
|
margin: 0;
|
|
color: #2c3e50;
|
|
}
|
|
.prefix-count {
|
|
background: #e74c3c;
|
|
color: white;
|
|
padding: 5px 12px;
|
|
border-radius: 20px;
|
|
font-size: 14px;
|
|
font-weight: bold;
|
|
}
|
|
.prefix-table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
background: white;
|
|
border: 1px solid #e0e0e0;
|
|
border-radius: 6px;
|
|
overflow: hidden;
|
|
}
|
|
.prefix-table th {
|
|
background: #34495e;
|
|
color: white;
|
|
padding: 12px;
|
|
text-align: left;
|
|
font-weight: 600;
|
|
}
|
|
.prefix-table td {
|
|
padding: 12px;
|
|
border-bottom: 1px solid #e0e0e0;
|
|
}
|
|
.prefix-table tr:hover {
|
|
background: #f8f9fa;
|
|
}
|
|
.prefix-table tr:last-child td {
|
|
border-bottom: none;
|
|
}
|
|
.prefix-link {
|
|
color: #3498db;
|
|
text-decoration: none;
|
|
font-family: monospace;
|
|
}
|
|
.prefix-link:hover {
|
|
text-decoration: underline;
|
|
}
|
|
.age {
|
|
color: #7f8c8d;
|
|
font-size: 14px;
|
|
}
|
|
.nav-link {
|
|
display: inline-block;
|
|
margin-bottom: 20px;
|
|
color: #3498db;
|
|
text-decoration: none;
|
|
}
|
|
.nav-link:hover {
|
|
text-decoration: underline;
|
|
}
|
|
.empty-state {
|
|
text-align: center;
|
|
padding: 40px;
|
|
color: #7f8c8d;
|
|
}
|
|
@media (max-width: 768px) {
|
|
.container {
|
|
padding: 20px;
|
|
}
|
|
.info-grid {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<a href="/status" class="nav-link">← Back to Status</a>
|
|
|
|
<h1>AS{{.ASN.ASN}}{{if .ASN.Handle}} - {{.ASN.Handle}}{{end}}</h1>
|
|
{{if .ASN.Description}}
|
|
<p class="subtitle">{{.ASN.Description}}</p>
|
|
{{end}}
|
|
|
|
<div class="info-grid">
|
|
<div class="info-card">
|
|
<div class="info-label">Total Prefixes</div>
|
|
<div class="info-value">{{.TotalCount}}</div>
|
|
</div>
|
|
<div class="info-card">
|
|
<div class="info-label">IPv4 Prefixes</div>
|
|
<div class="info-value">{{.IPv4Count}}</div>
|
|
</div>
|
|
<div class="info-card">
|
|
<div class="info-label">IPv6 Prefixes</div>
|
|
<div class="info-value">{{.IPv6Count}}</div>
|
|
</div>
|
|
<div class="info-card">
|
|
<div class="info-label">Peer ASNs</div>
|
|
<div class="info-value">{{.PeerCount}}</div>
|
|
</div>
|
|
<div class="info-card">
|
|
<div class="info-label">First Seen</div>
|
|
<div class="info-value">{{.ASN.FirstSeen.Format "2006-01-02"}}</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{if .IPv4Prefixes}}
|
|
<div class="prefix-section">
|
|
<div class="prefix-header">
|
|
<h2>IPv4 Prefixes</h2>
|
|
<span class="prefix-count">{{.IPv4Count}}</span>
|
|
</div>
|
|
<table class="prefix-table">
|
|
<thead>
|
|
<tr>
|
|
<th>Prefix</th>
|
|
<th>Mask Length</th>
|
|
<th>Last Updated</th>
|
|
<th>Age</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{range .IPv4Prefixes}}
|
|
<tr>
|
|
<td><a href="/prefix/{{.Prefix | urlEncode}}" class="prefix-link">{{.Prefix}}</a></td>
|
|
<td>/{{.MaskLength}}</td>
|
|
<td>{{.LastUpdated.Format "2006-01-02 15:04:05"}}</td>
|
|
<td class="age">{{.LastUpdated | timeSince}}</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{{end}}
|
|
|
|
{{if .IPv6Prefixes}}
|
|
<div class="prefix-section">
|
|
<div class="prefix-header">
|
|
<h2>IPv6 Prefixes</h2>
|
|
<span class="prefix-count">{{.IPv6Count}}</span>
|
|
</div>
|
|
<table class="prefix-table">
|
|
<thead>
|
|
<tr>
|
|
<th>Prefix</th>
|
|
<th>Mask Length</th>
|
|
<th>Last Updated</th>
|
|
<th>Age</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{range .IPv6Prefixes}}
|
|
<tr>
|
|
<td><a href="/prefix/{{.Prefix | urlEncode}}" class="prefix-link">{{.Prefix}}</a></td>
|
|
<td>/{{.MaskLength}}</td>
|
|
<td>{{.LastUpdated.Format "2006-01-02 15:04:05"}}</td>
|
|
<td class="age">{{.LastUpdated | timeSince}}</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{{end}}
|
|
|
|
{{if eq .TotalCount 0}}
|
|
<div class="empty-state">
|
|
<p>No prefixes announced by this AS</p>
|
|
</div>
|
|
{{end}}
|
|
|
|
{{if .Peers}}
|
|
<div class="prefix-section">
|
|
<div class="prefix-header">
|
|
<h2>Peer ASNs</h2>
|
|
<span class="prefix-count">{{.PeerCount}}</span>
|
|
</div>
|
|
<table class="prefix-table">
|
|
<thead>
|
|
<tr>
|
|
<th>ASN</th>
|
|
<th>Handle</th>
|
|
<th>Description</th>
|
|
<th>First Seen</th>
|
|
<th>Last Seen</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{range .Peers}}
|
|
<tr>
|
|
<td><a href="/as/{{.ASN}}" class="prefix-link">AS{{.ASN}}</a></td>
|
|
<td>{{if .Handle}}{{.Handle}}{{else}}-{{end}}</td>
|
|
<td>{{if .Description}}{{.Description}}{{else}}-{{end}}</td>
|
|
<td>{{.FirstSeen.Format "2006-01-02"}}</td>
|
|
<td>{{.LastSeen.Format "2006-01-02"}}</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{{else}}
|
|
<div class="prefix-section">
|
|
<h2>Peer ASNs</h2>
|
|
<div class="empty-state">
|
|
<p>No peering relationships found for this AS</p>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
</body>
|
|
</html> |