Move per-rule user options onto their owning rules
All checks were successful
continuous-integration/drone/tag Build is passing
continuous-integration/drone/push Build is passing

Each of the seven user options was read by exactly one rule, so expose
them via CheckRuleWithOptions instead of the checker-wide UserOpts list.
This keeps each rule's configuration colocated with its evaluation
logic.
This commit is contained in:
nemunaire 2026-05-19 21:51:12 +08:00
commit 81ca1810f1
5 changed files with 76 additions and 48 deletions

View file

@ -114,6 +114,25 @@ func (rrsigFreshnessRule) Name() string { return "dnssec_rrsig_freshness" }
func (rrsigFreshnessRule) Description() string {
return "Warns when RRSIGs are close to expiring; preemptive alert for stuck signers."
}
func (rrsigFreshnessRule) Options() sdk.CheckerOptionsDocumentation {
return sdk.CheckerOptionsDocumentation{
UserOpts: []sdk.CheckerOptionDocumentation{
{
Id: "signatureFreshness",
Type: "uint",
Label: "RRSIG freshness WARN threshold (days)",
Description: "Warn when the closest RRSIG expires in fewer than this many days.",
Default: defaultSignatureFreshnessDays,
},
{
Id: "signatureFreshnessCrit",
Type: "uint",
Label: "RRSIG freshness CRIT threshold (days)",
Default: defaultSignatureFreshnessCrit,
},
},
}
}
func (rrsigFreshnessRule) Evaluate(ctx context.Context, obs sdk.ObservationGetter, opts sdk.CheckerOptions) []sdk.CheckState {
data, errState := loadDNSSEC(ctx, obs)