Read every route from the routing table in memory (part of #122)
check / check (push) Canceled after 0s

The IP lookups, the AS and prefix pages and their API answers, the prefix-length pages and the stats read routes only from the routing table the prefix handler keeps. fx reads the table at startup and gives it to both. AS names, WHOIS details and first-seen times still come from the database.

The IP lookup names the origin AS most peers carry, with the time of the newest kept route. The prefix answers list peers whose routes are not kept without a path or time. The stats gain origins_without_kept_route. They no longer read route times from the per-peer tables, so the two helpers that did are gone.

Model: opus-5-5
This commit was merged in pull request #194.
This commit is contained in:
2026-10-27 16:21:59 +01:00
parent 2c304a0022
commit 506e289a63
18 changed files with 1335 additions and 656 deletions
+10 -1
View File
@@ -3,6 +3,10 @@
// - the AS, prefix and prefix length pages, and the JSON answers behind them
// - the IP lookups
// - the AS name search
//
// Every route it shows comes from the routing table in memory. AS names,
// WHOIS details and the times a prefix and an AS were first seen come from
// the database.
package server
import (
@@ -19,6 +23,7 @@ import (
"git.eeqj.de/sneak/routewatch/internal/config"
"git.eeqj.de/sneak/routewatch/internal/database"
"git.eeqj.de/sneak/routewatch/internal/logger"
"git.eeqj.de/sneak/routewatch/internal/routetable"
"git.eeqj.de/sneak/routewatch/internal/streamer"
"github.com/go-chi/chi/v5"
)
@@ -55,6 +60,7 @@ type dnsResolver interface {
type Server struct {
router *chi.Mux
db database.Store
table *routetable.Table
streamer *streamer.Streamer
logger *logger.Logger
port int
@@ -71,15 +77,18 @@ type Server struct {
resolver dnsResolver
}
// New creates a new HTTP server
// New creates a new HTTP server that reads routes from table, the routing
// table that the prefix handler keeps current.
func New(
db database.Store,
table *routetable.Table,
streamer *streamer.Streamer,
logger *logger.Logger,
cfg *config.Config,
) *Server {
s := &Server{
db: db,
table: table,
streamer: streamer,
logger: logger,
port: cfg.Port,