Enforce prober/evaluator boundary in ObservationData
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
nemunaire 2026-05-15 17:43:21 +08:00
commit 0903357221

View file

@ -3,6 +3,7 @@ package checker
import (
"encoding/json"
"fmt"
"slices"
"github.com/miekg/dns"
)
@ -77,10 +78,8 @@ type NSResult struct {
// Dedupes identical messages and caps the list with a sentinel summary.
func (n *NSResult) appendError(format string, args ...any) {
msg := fmt.Sprintf(format, args...)
for _, e := range n.Errors {
if e == msg {
return
}
if slices.Contains(n.Errors, msg) {
return
}
if len(n.Errors) >= maxNSResultErrors {
n.suppressedErrors++
@ -106,9 +105,8 @@ type ObservationData struct {
ParentNS []string `json:"parent_ns,omitempty"`
ParentQueryError string `json:"parent_query_error,omitempty"`
// Union of DeclaredNS and ParentNS, de-duplicated.
Probed []string `json:"probed,omitempty"`
Results map[string]*NSResult `json:"results,omitempty"`
Findings []Finding `json:"findings"`
Probed []string `json:"probed,omitempty"`
Results map[string]*NSResult `json:"results,omitempty"`
}
// Local mirror of happyDomain's services/abstract.Origin. Duplicated on