Rename blocklists to IP lists and add IP lookup flags (closes #233)
check / check (push) Failing after 1m7s

The answer field is now ip_lists, the package internal/iplist and the
state directory iplists. No compatibility is kept for the old names.

Every IP lookup result gains a flags object with is_tor and is_bogon.
The largest list file accepted is now 200 MiB.

Model: opus-5-5
This commit is contained in:
sneak committed 2026-11-10 09:27:12 +00:00
1 parent e58c6635e7
commit 9e8f687511
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
}