Add internal/routetable, the routing table in memory (part of #122)
check / check (push) Waiting to run

A new package holds every prefix some peer carries. For each prefix and
origin AS it keeps the set of peers that carry it, one bit per peer,
and the two newest of their routes in full. It applies announcements,
withdrawals and peers' sessions going down by the rule confirmed on the
issue, and records which pairs changed for the database writes to come.
It answers the IP lookup, an AS's prefixes, a prefix's origins, a sample
of one mask length, and the counts the stats show. Nothing uses it yet.

The peer sets use github.com/bits-and-blooms/bitset. The kept routes'
times are held in order in github.com/google/btree, so the oldest and
newest need no scan.

Model: opus-5-5
This commit is contained in:
2026-10-27 06:39:16 +00:00
parent 7e13f28aa0
commit 3edf68f6af
9 changed files with 1776 additions and 4 deletions
+2
View File
@@ -3,8 +3,10 @@ module git.eeqj.de/sneak/routewatch
go 1.27.1
require (
github.com/bits-and-blooms/bitset v1.26.0
github.com/dustin/go-humanize v1.0.1
github.com/go-chi/chi/v5 v5.2.2
github.com/google/btree v1.1.3
github.com/google/uuid v1.6.0
github.com/mattn/go-sqlite3 v1.14.29
github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9