Each registered Source now becomes its own CheckRule (name = source ID) implementing CheckRuleWithOptions, so the host can toggle blacklists individually and the per-source option fields show up under the rule that owns them instead of one flat global option list. Collect honours the host's per-rule enable map (via the SDK's RuleEnabled context helper) and skips the network call for disabled sources entirely, not just their evaluation.
48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
package checker
|
|
|
|
import (
|
|
"time"
|
|
|
|
sdk "git.happydns.org/checker-sdk-go/checker"
|
|
)
|
|
|
|
// Version is overridden at link time by the standalone or plugin entrypoints.
|
|
var Version = "built-in"
|
|
|
|
// Definition assembles the checker definition. Per-source option fields
|
|
// live on each per-source rule (CheckRuleWithOptions); the global Options
|
|
// only carries the shared domain target.
|
|
func Definition() *sdk.CheckerDefinition {
|
|
opts := sdk.CheckerOptionsDocumentation{
|
|
DomainOpts: []sdk.CheckerOptionDocumentation{
|
|
{
|
|
Id: "domain_name",
|
|
Label: "Domain name",
|
|
AutoFill: sdk.AutoFillDomainName,
|
|
},
|
|
},
|
|
}
|
|
|
|
return &sdk.CheckerDefinition{
|
|
ID: "blacklist",
|
|
Name: "Blacklist & reputation",
|
|
Version: Version,
|
|
|
|
Availability: sdk.CheckerAvailability{
|
|
ApplyToDomain: true,
|
|
},
|
|
ObservationKeys: []sdk.ObservationKey{ObservationKeyBlacklist},
|
|
|
|
Options: opts,
|
|
Rules: Rules(),
|
|
|
|
Interval: &sdk.CheckIntervalSpec{
|
|
Min: 30 * time.Minute,
|
|
Max: 24 * time.Hour,
|
|
Default: 6 * time.Hour,
|
|
},
|
|
|
|
HasHTMLReport: true,
|
|
HasMetrics: true,
|
|
}
|
|
}
|