Show figures of the routing table on the home page (closes #154)
check / check (push) Canceled after 0s

The home page gets cards for the newest and oldest kept route, the newest
and oldest updated AS, the AS with the most prefixes, the ASes with a
single prefix and fifteen well-known networks. Two more cards count the
bogon announcements and the prefixes with several origin ASes. They link
to the new pages /bogons and /multiple-origins, which list up to 1,000
entries each.

The new package internal/bogon tells reserved prefixes and AS numbers,
from the IANA special-purpose and address space registries. Table.Overview
walks the table and lets the read lock go every 10,000 prefixes. The
server works the cards out once a minute and serves that copy. A new index
on asns(last_seen) finds the newest and oldest updated AS.

Model: opus-5-5
This commit was merged in pull request #196.
This commit is contained in:
2026-10-27 18:27:01 +01:00
parent e68be8254a
commit 281d162e27
23 changed files with 2240 additions and 6 deletions
+149
View File
@@ -276,6 +276,52 @@
margin-top: 12px;
}
/* Cards with figures of the routing table, worked out once a minute */
#table-cards p,
#well-known p {
margin: 0 0 8px 0;
font-size: 14px;
}
#table-cards a,
#well-known a {
color: #3498db;
text-decoration: none;
}
#table-cards a:hover,
#well-known a:hover {
text-decoration: underline;
}
#table-cards .card-figure {
font-size: 32px;
font-weight: bold;
}
#table-cards .card-detail,
#table-cards .card-time {
color: #7f8c8d;
font-size: 12px;
}
#table-cards .prefix {
font-family: 'SF Mono', Monaco, 'Cascadia Mono', 'Roboto Mono', Consolas, 'Courier New', monospace;
}
#well-known {
margin-bottom: 40px;
}
#well-known table {
width: 100%;
border-collapse: collapse;
font-size: 14px;
}
#well-known th,
#well-known td {
text-align: left;
padding: 8px 4px;
border-bottom: 1px solid #eee;
}
#well-known th {
color: #7f8c8d;
font-weight: 600;
}
/* Footer */
.footer {
margin-top: 40px;
@@ -381,6 +427,109 @@
</div>
</div>
{{ with .Cards }}
<div class="search-section" id="table-cards">
<div class="search-card">
<h2>Newest Updated Route</h2>
{{ with .NewestRoute }}
<p><a href="{{ prefixURL .Prefix.String }}" class="prefix">{{ .Prefix }}</a> from {{ if .OriginASN }}<a href="/as/{{ .OriginASN }}">AS{{ .OriginASN }}</a>{{ else }}no known origin{{ end }}</p>
<p class="card-time">{{ .Time.UTC.Format "2006-01-02 15:04:05" }} UTC, {{ timeSince .Time }}</p>
{{ else }}
<p>The routing table keeps no route yet.</p>
{{ end }}
</div>
<div class="search-card">
<h2>Oldest Updated Route</h2>
{{ with .OldestRoute }}
<p><a href="{{ prefixURL .Prefix.String }}" class="prefix">{{ .Prefix }}</a> from {{ if .OriginASN }}<a href="/as/{{ .OriginASN }}">AS{{ .OriginASN }}</a>{{ else }}no known origin{{ end }}</p>
<p class="card-time">{{ .Time.UTC.Format "2006-01-02 15:04:05" }} UTC, {{ timeSince .Time }}</p>
{{ else }}
<p>The routing table keeps no route yet.</p>
{{ end }}
</div>
<div class="search-card">
<h2>Newest Updated AS</h2>
{{ with .NewestAS }}
<p><a href="/as/{{ .ASN }}">AS{{ .ASN }}</a> {{ .Handle }}</p>
<p class="card-detail">{{ .Description }}</p>
<p class="card-time">Last seen {{ .LastSeen.UTC.Format "2006-01-02 15:04:05" }} UTC, {{ timeSince .LastSeen }}</p>
{{ else }}
<p>No AS has been seen yet.</p>
{{ end }}
</div>
<div class="search-card">
<h2>Oldest Updated AS</h2>
{{ with .OldestAS }}
<p><a href="/as/{{ .ASN }}">AS{{ .ASN }}</a> {{ .Handle }}</p>
<p class="card-detail">{{ .Description }}</p>
<p class="card-time">Last seen {{ .LastSeen.UTC.Format "2006-01-02 15:04:05" }} UTC, {{ timeSince .LastSeen }}</p>
{{ else }}
<p>No AS has been seen yet.</p>
{{ end }}
</div>
<div class="search-card">
<h2>AS with the Most Prefixes</h2>
{{ if .MostPrefixes }}
<p><a href="/as/{{ .MostPrefixesASN }}">AS{{ .MostPrefixesASN }}</a></p>
<p>Prefixes it originates: {{ .MostPrefixes }}</p>
{{ else }}
<p>No AS originates a prefix yet.</p>
{{ end }}
</div>
<div class="search-card">
<h2>ASes with the Fewest Prefixes</h2>
<p>ASes that originate a single prefix: {{ .SinglePrefixASes }}</p>
{{ with .NewestSinglePrefix }}
<p>The most recently updated of them: <a href="/as/{{ .OriginASN }}">AS{{ .OriginASN }}</a>, with <a href="{{ prefixURL .Prefix.String }}" class="prefix">{{ .Prefix }}</a></p>
<p class="card-time">{{ .Time.UTC.Format "2006-01-02 15:04:05" }} UTC, {{ timeSince .Time }}</p>
{{ end }}
</div>
<div class="search-card">
<h2>Bogon Announcements</h2>
<p class="card-figure"><a href="/bogons">{{ .BogonCount }}</a></p>
<p>Routes that announce a reserved prefix, or that come from a reserved AS number</p>
</div>
<div class="search-card">
<h2>Prefixes with Several Origins</h2>
<p class="card-figure"><a href="/multiple-origins">{{ .MultipleOriginCount }}</a></p>
<p>Prefixes announced by more than one origin AS</p>
</div>
</div>
<div class="search-card" id="well-known">
<h2>Well-Known Networks</h2>
<table>
<thead>
<tr>
<th>Network</th>
<th>Prefixes</th>
<th>Last Update</th>
</tr>
</thead>
<tbody>
{{ range .WellKnownNetworks }}
<tr>
<td><a href="/as/{{ .ASN }}">AS{{ .ASN }}</a> {{ .Name }}</td>
<td>{{ .Prefixes }}</td>
<td>{{ with .Newest }}{{ timeSince . }}{{ else }}no route{{ end }}</td>
</tr>
{{ end }}
</tbody>
</table>
</div>
{{ else }}
<div class="search-card" id="well-known">
<p>The figures of the routing table are being worked out. Reload the page in a minute.</p>
</div>
{{ end }}
<div class="search-card" id="ip-api">
<h2>IP Information API</h2>
<p>The API answers what RouteWatch knows about an IP address, such as its AS number and country. <code>/ip/</code> with no address answers for the caller's own address.</p>