Look up IP addresses by prefix at each mask length (closes #48)
check / check (push) Successful in 3m13s
check / check (push) Successful in 3m13s
Looking up an address on /ip/ and /api/v1/ip/ read every IPv6 live route and about half of the IPv4 range index, so on a day-sized database it passed the 30-second request timeout. The lookup is now one function for both families: from the longest mask length down, it looks up the address's network prefix on the existing prefix index, and the first live route wins. The feed sends IPv6 withdrawals uncompressed, so they never matched the stored compressed prefix and never removed a route. Prefixes are now stored in the text form net/netip prints, so IPv6 withdrawals take effect. ip_start, ip_end and GetASInfoForIP are removed; nothing read them. A database from before this change must be deleted. Model: opus-5-5
This commit was merged in pull request #51.
This commit is contained in:
@@ -142,7 +142,10 @@ routewatch/
|
||||
- **Backpressure**: Probabilistic message dropping when queues exceed 50% capacity
|
||||
- **Graceful Shutdown**: 60-second timeout, flushes all pending batches
|
||||
- **Reconnection**: Exponential backoff (5s-320s) with reset after 30s of stable connection
|
||||
- **IPv4 Optimization**: IP ranges stored as uint32 for O(1) lookups
|
||||
- **IP Lookup**: the most specific live route is found by looking up the
|
||||
address's prefix at each mask length, longest first, in the prefix index
|
||||
(at most 33 lookups for IPv4, 129 for IPv6); prefixes are stored in the
|
||||
text form Go's `net/netip` prints
|
||||
|
||||
### Database Schema
|
||||
|
||||
@@ -154,7 +157,7 @@ prefixes_v6(id, prefix, mask_length, first_seen, last_seen)
|
||||
|
||||
-- Live routing tables (one per IP version)
|
||||
live_routes_v4(id, prefix, mask_length, origin_asn, peer_ip, as_path,
|
||||
next_hop, last_updated, v4_ip_start, v4_ip_end)
|
||||
next_hop, last_updated)
|
||||
live_routes_v6(id, prefix, mask_length, origin_asn, peer_ip, as_path,
|
||||
next_hop, last_updated)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user