Part of #203, from item 6 and "The two caches" of the proposal sneak agreed to (#203 (comment), #203 (comment)). His words: "we should fetch using DoH from Google, Cloudflare, other public reliable resolvers, and cache locally based on record TTL. cache lives in ram, persists to disk, and is loaded on startup. sqlite on disk, probably."
ptr keeps its field and shape. Today it asks the host's resolver, 2 seconds per address, with no cache. Depends on the rename issue linked from the plan on that issue.
Change.
New package internal/cachedb: opens cache.db in the state directory (WAL mode, the SQLite driver already in go.mod), separate from the routes database so a cache write never queues behind it. It holds the hostname table; the geolocation issue adds its own.
New package internal/ptr: resolves an address's PTR names over DNS-over-HTTPS, RFC 8484 wire format, packed and parsed with github.com/miekg/dns. It tries Google, Cloudflare, AdGuard and Quad9 in turn, 2 seconds in all per address.
The cache, in that package:
In memory, loaded from cache.db at startup, written through in a batch every few seconds.
The expiry is the record's TTL, at least 60 seconds and at most 24 hours. A name with no PTR is cached for the SOA minimum, at most 1 hour. A failed query is not cached.
A sweep every 10 minutes deletes expired rows.
lookupPTRNames in internal/server/handlers.go uses it.
sneak's choice of SQLite for this cache overrides the standing rule that small state is a JSON file.
Tests. A fake resolver over httptest: order and failover, the 2-second limit, TTL clamping, the negative TTL, a failed query not cached; the cache surviving a restart; expired rows swept. Addresses from documentation ranges.
Done when. A real lookup of a public address returns its name over DoH (one line on the PR) and a second lookup makes no request; the README describes the resolvers, the cache and what the lookup sends outside.
Model: opus-5-5
Part of https://git.eeqj.de/sneak/routewatch/issues/203, from item 6 and "The two caches" of the proposal sneak agreed to (https://git.eeqj.de/sneak/routewatch/issues/203#issuecomment-159864, https://git.eeqj.de/sneak/routewatch/issues/203#issuecomment-165190). His words: "we should fetch using DoH from Google, Cloudflare, other public reliable resolvers, and cache locally based on record TTL. cache lives in ram, persists to disk, and is loaded on startup. sqlite on disk, probably."
`ptr` keeps its field and shape. Today it asks the host's resolver, 2 seconds per address, with no cache. Depends on the rename issue linked from the plan on that issue.
**Change.**
1. New package `internal/cachedb`: opens `cache.db` in the state directory (WAL mode, the SQLite driver already in `go.mod`), separate from the routes database so a cache write never queues behind it. It holds the hostname table; the geolocation issue adds its own.
2. New package `internal/ptr`: resolves an address's PTR names over DNS-over-HTTPS, RFC 8484 wire format, packed and parsed with `github.com/miekg/dns`. It tries Google, Cloudflare, AdGuard and Quad9 in turn, 2 seconds in all per address.
3. The cache, in that package:
- In memory, loaded from `cache.db` at startup, written through in a batch every few seconds.
- The expiry is the record's TTL, at least 60 seconds and at most 24 hours. A name with no PTR is cached for the SOA minimum, at most 1 hour. A failed query is not cached.
- A sweep every 10 minutes deletes expired rows.
4. `lookupPTRNames` in `internal/server/handlers.go` uses it.
sneak's choice of SQLite for this cache overrides the standing rule that small state is a JSON file.
**Tests.** A fake resolver over `httptest`: order and failover, the 2-second limit, TTL clamping, the negative TTL, a failed query not cached; the cache surviving a restart; expired rows swept. Addresses from documentation ranges.
**Done when.** A real lookup of a public address returns its name over DoH (one line on the PR) and a second lookup makes no request; the README describes the resolvers, the cache and what the lookup sends outside.
Model: opus-5-5
clawbot
self-assigned this 2026-11-10 10:15:09 +01:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Part of #203, from item 6 and "The two caches" of the proposal sneak agreed to (#203 (comment), #203 (comment)). His words: "we should fetch using DoH from Google, Cloudflare, other public reliable resolvers, and cache locally based on record TTL. cache lives in ram, persists to disk, and is loaded on startup. sqlite on disk, probably."
ptrkeeps its field and shape. Today it asks the host's resolver, 2 seconds per address, with no cache. Depends on the rename issue linked from the plan on that issue.Change.
internal/cachedb: openscache.dbin the state directory (WAL mode, the SQLite driver already ingo.mod), separate from the routes database so a cache write never queues behind it. It holds the hostname table; the geolocation issue adds its own.internal/ptr: resolves an address's PTR names over DNS-over-HTTPS, RFC 8484 wire format, packed and parsed withgithub.com/miekg/dns. It tries Google, Cloudflare, AdGuard and Quad9 in turn, 2 seconds in all per address.cache.dbat startup, written through in a batch every few seconds.lookupPTRNamesininternal/server/handlers.gouses it.sneak's choice of SQLite for this cache overrides the standing rule that small state is a JSON file.
Tests. A fake resolver over
httptest: order and failover, the 2-second limit, TTL clamping, the negative TTL, a failed query not cached; the cache surviving a restart; expired rows swept. Addresses from documentation ranges.Done when. A real lookup of a public address returns its name over DoH (one line on the PR) and a second lookup makes no request; the README describes the resolvers, the cache and what the lookup sends outside.
Model: opus-5-5
Built in #244, which has the judgement calls and disclosures.
Model: opus-5-5
clawbot referenced this issue2026-11-10 13:48:10 +01:00