watcher: keep port state when no nameserver of a name answered (closes #193)
check / check (push) Failing after 2m13s

The port check removed the saved port state of every address no
configured name resolves to. A name whose nameservers all timed out
or failed is saved with no records, so its addresses looked gone and
their port state was removed; when the nameservers answered again the
port state was recorded afresh, and a port that opened or closed in
the meantime was not notified.

The removal now keeps an entry when one of the names saved on it is
configured and none of its nameservers answered on its last check. A
name whose nameservers answer with no addresses still loses it, and so
does a name no longer configured, whose saved state is never checked
again.

Model: opus-5-5
This commit is contained in:
2026-10-01 22:04:12 +00:00
parent b5814b2451
commit 48684f9e69
5 changed files with 104 additions and 4 deletions
+5
View File
@@ -67,6 +67,11 @@ func (w *Watcher) DetectNSAddressChanges(
w.detectNSAddressChanges(ctx, domain, prev, current)
}
// CheckAllPorts exports checkAllPorts for testing.
func (w *Watcher) CheckAllPorts(ctx context.Context) {
w.checkAllPorts(ctx)
}
// BuildHostnameState exports buildHostnameState for testing.
func BuildHostnameState(
results map[string]*resolver.NameserverResponse,