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