healthcheck: answer 503 when no root server gave a usable reply in the last round of DNS checks (closes #302)
check / check (push) Waiting to run

The health check answered ok while every DNS lookup failed, as on a
network that intercepts DNS queries. A lookup whose root servers give no
usable reply now fails with ErrNoRootServerAnswered. At the end of each
round of DNS checks that shutdown did not cut short, the watcher records
whether every lookup failed with it or with ErrIntercepted; the health
check then gives status error, and /.well-known/healthcheck and /health
answer 503. Until the first round finishes it stays ok.

The health check now depends on the watcher, so fx starts the watcher
before the HTTP server and stops the server first. NewWithRootServers
lets tests start a resolver's walks at real servers that are not root
servers.

Model: opus-5-5
This commit was merged in pull request #304.
This commit is contained in:
2026-10-18 17:24:49 +02:00
parent b23cf43abf
commit 774f7caff6
14 changed files with 534 additions and 45 deletions
+6
View File
@@ -36,6 +36,12 @@ var (
// so whether the name has addresses is unknown.
ErrNoNameserverAnswered = errors.New("no nameserver answered")
// ErrNoRootServerAnswered is returned when the root servers were
// asked and none of them gave a usable reply, as when the host
// running dnswatcher has lost its network. When they all refused,
// the error is ErrIntercepted instead.
ErrNoRootServerAnswered = errors.New("no root server answered")
// ErrNoNameserverAddress is returned when a nameserver is to be
// asked and no address for it was given.
ErrNoNameserverAddress = errors.New("nameserver has no address")