query reads an answer through a reader capped at maxAnswerSize (1 MiB). An answer that reaches the cap is an error, and none of it is returned.
A refer: line in IANA's answer that names a server none of the five RIRs run is now an error instead of being dialled as given, so the client only ever connects to IANA and the five RIR servers. parseIANAReferral returns that error and LookupASN passes it on.
What the diff does not show
The fetcher treats both errors like any failed lookup: it backs off, stores nothing, and tries the AS again later.
An answer of exactly 1 MiB also counts as too large.
The RIR match is the existing substring test (any name containing ripe maps to whois.ripe.net:43). It always dials one of the five fixed addresses, so it is left as it was.
Disclosures
Deviation: the cap is an io.LimitedReader, the type io.LimitReader returns, built directly so the code can read how many bytes were left and tell that the cap was reached.
Deviation: the test's server sends 4 MiB of lines instead of streaming for 2 s, so whether it passes the cap does not depend on machine speed.
Judgement call: of the issue's two options, referrals are followed only to the five RIR servers, not to any host on port 43; every AS number IANA hands out is held by one of the five.
Model: opus-5-5
Fixes https://git.eeqj.de/sneak/routewatch/issues/106.
**What changed**
- `query` reads an answer through a reader capped at `maxAnswerSize` (1 MiB). An answer that reaches the cap is an error, and none of it is returned.
- A `refer:` line in IANA's answer that names a server none of the five RIRs run is now an error instead of being dialled as given, so the client only ever connects to IANA and the five RIR servers. `parseIANAReferral` returns that error and `LookupASN` passes it on.
**What the diff does not show**
- The fetcher treats both errors like any failed lookup: it backs off, stores nothing, and tries the AS again later.
- An answer of exactly 1 MiB also counts as too large.
- The RIR match is the existing substring test (any name containing `ripe` maps to `whois.ripe.net:43`). It always dials one of the five fixed addresses, so it is left as it was.
**Disclosures**
- Deviation: the cap is an `io.LimitedReader`, the type `io.LimitReader` returns, built directly so the code can read how many bytes were left and tell that the cap was reached.
- Deviation: the test's server sends 4 MiB of lines instead of streaming for 2 s, so whether it passes the cap does not depend on machine speed.
- Judgement call: of the issue's two options, referrals are followed only to the five RIR servers, not to any host on port 43; every AS number IANA hands out is held by one of the five.
Model: opus-5-5
The client kept every line a WHOIS server sent until the server closed
the connection or 30 seconds passed, so a server that kept sending
could fill memory. It now reads at most 1 MiB of an answer, and an
answer that reaches that is an error. A "refer:" line in IANA's answer
naming a server none of the five RIRs run was dialled as given, on any
host and port; it is now an error, so the client only connects to IANA
and the five RIR servers. Both errors are failed lookups, which the
fetcher retries later.
Model: opus-5-5
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.
Fixes #106.
What changed
queryreads an answer through a reader capped atmaxAnswerSize(1 MiB). An answer that reaches the cap is an error, and none of it is returned.refer:line in IANA's answer that names a server none of the five RIRs run is now an error instead of being dialled as given, so the client only ever connects to IANA and the five RIR servers.parseIANAReferralreturns that error andLookupASNpasses it on.What the diff does not show
ripemaps towhois.ripe.net:43). It always dials one of the five fixed addresses, so it is left as it was.Disclosures
io.LimitedReader, the typeio.LimitReaderreturns, built directly so the code can read how many bytes were left and tell that the cap was reached.Model: opus-5-5
Review passed.
Model: opus-5-5