package checker import ( "time" sdk "git.happydns.org/checker-sdk-go/checker" ) // Version is overridden at build time via -ldflags by main.go and // plugin/plugin.go. Use SetVersion from entrypoints rather than // assigning to it directly. var Version = "built-in" // SetVersion updates the package-level Version reported in the // CheckerDefinition. Empty values are ignored so an entrypoint that // forgets its own ldflags does not erase the default. func SetVersion(v string) { if v != "" { Version = v } } // Definition exposes the checker to the happyDomain host. // // The checker is zone-scoped: it inspects every pointer service in a // single pass so the report consolidates findings by owner instead of // fanning one observation out per service. func Definition() *sdk.CheckerDefinition { def := &sdk.CheckerDefinition{ ID: "dangling", Name: "Dangling subdomains", Version: Version, Availability: sdk.CheckerAvailability{ ApplyToZone: true, }, ObservationKeys: []sdk.ObservationKey{ObservationKeyDangling}, Options: sdk.CheckerOptionsDocumentation{ DomainOpts: []sdk.CheckerOptionDocumentation{ { Id: "domain_name", Type: "string", Label: "Domain name", AutoFill: sdk.AutoFillDomainName, Hide: true, }, { Id: "zone", Type: "string", Label: "Zone", AutoFill: sdk.AutoFillZone, Hide: true, }, }, RunOpts: []sdk.CheckerOptionDocumentation{ { Id: "skip_resolution", Type: "bool", Label: "Skip live DNS resolution", Description: "When set, the checker only reports the static structure of pointer records. Useful for offline analysis; defaults to false.", Default: false, }, }, }, Rules: []sdk.CheckRule{ &danglingRule{}, }, HasHTMLReport: true, Interval: &sdk.CheckIntervalSpec{ Min: 15 * time.Minute, Max: 7 * 24 * time.Hour, Default: 12 * time.Hour, }, } def.BuildRulesInfo() return def }