diff --git a/checker/provider.go b/checker/provider.go index ad7e3b3..a7d9825 100644 --- a/checker/provider.go +++ b/checker/provider.go @@ -4,10 +4,16 @@ package checker import ( "context" + "errors" sdk "git.happydns.org/checker-sdk-go/checker" ) +// ErrNoCollector is returned by Collect when the provider was constructed +// without a CollectFn (e.g. when registered host-side as an externalizable-only +// provider). Callers should route the observation to an external checker. +var ErrNoCollector = errors.New("dnsviz: provider has no local collector; use an external checker") + // CollectFn is the function signature for the DNSViz data collection step. // The checker package is decoupled from the subprocess invocation so it can // be imported without GPL obligations. Implementations live in the binary or @@ -27,5 +33,8 @@ func (p *dnsvizProvider) Key() sdk.ObservationKey { } func (p *dnsvizProvider) Collect(ctx context.Context, opts sdk.CheckerOptions) (any, error) { + if p.collect == nil { + return nil, ErrNoCollector + } return p.collect(ctx, opts) }