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,11 +78,9 @@ 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++
sentinel := fmt.Sprintf("(%d more error(s) suppressed)", n.suppressedErrors) sentinel := fmt.Sprintf("(%d more error(s) suppressed)", n.suppressedErrors)
@ -108,7 +107,6 @@ type ObservationData struct {
// 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