Rename blocklists to IP lists, add IP lookup flags, raise the download limit to 200 MiB (closes #233)
check / check (push) Failing after 10m45s

The lists are not only used for blocking, so the package, the `blocklists` field of the IP lookup answer and the state directory are now IP lists (`internal/iplist`, `ip_lists`, `iplists`). Every result gains a `flags` object with `is_tor` and `is_bogon`. The largest list file accepted is 200 MiB.

Judgement call: the dated 2026-10-27 `TODO.md` entry keeps the old word.
Rule suppressed: `tagliatelle` on the two result structs, for snake_case keys.

Model: opus-5-5
This commit was merged in pull request #241.
This commit is contained in:
clawbot committed 2026-11-10 10:48:23 +01:00
1 parent e58c6635e7
commit cf50d195ad
12 files changed
+375 -176

No files matched your search

+10 -10
View File
@@ -22,9 +22,9 @@ import (
"sync/atomic"
"time"
"git.eeqj.de/sneak/routewatch/internal/blocklist"
"git.eeqj.de/sneak/routewatch/internal/config"
"git.eeqj.de/sneak/routewatch/internal/database"
"git.eeqj.de/sneak/routewatch/internal/iplist"
"git.eeqj.de/sneak/routewatch/internal/logger"
"git.eeqj.de/sneak/routewatch/internal/routetable"
"git.eeqj.de/sneak/routewatch/internal/streamer"
@@ -45,10 +45,10 @@ type ASNFetcher interface {
GetStats() ASNFetcherStats
}
// Blocklists tells which public blocklists list an address, from copies it
// keeps in memory, as *blocklist.Blocklists does.
type Blocklists interface {
Lookup(addr netip.Addr) []blocklist.Listing
// IPLists tells which public IP lists contain an address, from copies it keeps
// in memory, as *iplist.IPLists does.
type IPLists interface {
Lookup(addr netip.Addr) []iplist.Listing
ShortestInterval() time.Duration
}
@@ -69,7 +69,7 @@ type Server struct {
port int
srv *http.Server
asnFetcher ASNFetcher
blocklists Blocklists
ipLists IPLists
// trustedProxies are the reverse proxies whose X-Forwarded-For header
// RealIPMiddleware believes
@@ -202,8 +202,8 @@ func (s *Server) SetASNFetcher(fetcher ASNFetcher) {
s.asnFetcher = fetcher
}
// SetBlocklists sets the blocklists the IP lookups report. Call it before
// Start: the handlers read the blocklists without a lock.
func (s *Server) SetBlocklists(blocklists Blocklists) {
s.blocklists = blocklists
// SetIPLists sets the IP lists the IP lookups report. Call it before Start:
// the handlers read the IP lists without a lock.
func (s *Server) SetIPLists(ipLists IPLists) {
s.ipLists = ipLists
}