From cf50d195ad6e9594d75154b1c1dda5300f3ee64e Mon Sep 17 00:00:00 2001 From: clawbot <35+clawbot@noreply.example.org> Date: Tue, 10 Nov 2026 10:48:23 +0100 Subject: [PATCH] Rename blocklists to IP lists, add IP lookup flags, raise the download limit to 200 MiB (closes #233) 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 --- README.md | 35 +++-- TODO.md | 8 +- internal/{blocklist => iplist}/download.go | 36 ++--- .../blocklist.go => iplist/iplist.go} | 34 ++--- .../iplist_internal_test.go} | 135 +++++++++++++---- internal/{blocklist => iplist}/lists.go | 9 +- internal/{blocklist => iplist}/parse.go | 2 +- internal/routewatch/app.go | 32 ++-- .../app_integration_internal_test.go | 2 +- internal/server/handlers.go | 95 +++++++++--- internal/server/handlers_internal_test.go | 143 +++++++++++++----- internal/server/server.go | 20 +-- 12 files changed, 375 insertions(+), 176 deletions(-) rename internal/{blocklist => iplist}/download.go (89%) rename internal/{blocklist/blocklist.go => iplist/iplist.go} (82%) rename internal/{blocklist/blocklist_internal_test.go => iplist/iplist_internal_test.go} (78%) rename internal/{blocklist => iplist}/lists.go (93%) rename internal/{blocklist => iplist}/parse.go (99%) diff --git a/README.md b/README.md index c024249..db4e730 100644 --- a/README.md +++ b/README.md @@ -44,8 +44,7 @@ its abuse contact. RouteWatch keeps them in its database and fetches them again once they are 30 days old. An IP lookup answers from the stored details and never waits for WHOIS. -An IP lookup also says which public blocklists list the address (see -Blocklists). +An IP lookup also says which public IP lists hold the address (see IP lists). ## Getting started @@ -65,7 +64,7 @@ docker run --memory=5g --memory-swap=5g -p 8080:8080 \ ``` The memory limit is explained in Memory. The volume holds the database and the -copies of the blocklists. +copies of the IP lists. To run the binary on the host instead, build it with `make build`. The build needs Go and a C compiler, because the SQLite library is written in C: @@ -284,8 +283,12 @@ address. Every entry has the same fields: - `ip`: the address - `ptr`: the address's PTR names, the host names that DNS gives for it, or an empty list when it has none -- `blocklists`: the public blocklists the address is on (see Blocklists), or an - empty list when it is on none +- `flags`: yes-or-no facts about the address: + - `is_tor`: true when the address is on the `tor_exits` list + - `is_bogon`: true when the address is reserved, so that no network should + announce it on the internet +- `ip_lists`: the public IP lists the address is on (see IP lists), or an empty + list when it is on none Every other field is about the prefix in the routing table that holds the address. Each is null when no prefix in the routing table holds the address: @@ -331,7 +334,7 @@ Each PTR lookup gets 2 seconds. An address whose lookup takes longer is answered without PTR names. A successful answer carries `Cache-Control` with a `max-age` of 15 minutes, the -shortest blocklist interval. The answer for the caller's own address (`/ip/`) is +shortest IP list interval. The answer for the caller's own address (`/ip/`) is `private`, and the others are `public`. ### Errors @@ -391,10 +394,10 @@ inline `