checker: adopt unified ReportContext reporter signature
Follow the checker-sdk-go interface consolidation: reporter methods now take sdk.ReportContext and read the payload via ctx.Data() instead of the raw json.RawMessage parameter. Backed by the same underlying logic — this is a signature migration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
aae1452e12
commit
df4a7a89d1
9 changed files with 480 additions and 32 deletions
|
|
@ -15,7 +15,17 @@ func Definition() *sdk.CheckerDefinition {
|
|||
Name: "CardDAV server",
|
||||
Version: Version,
|
||||
Availability: sdk.CheckerAvailability{
|
||||
// Domain scope for the probe itself (discovery runs across the
|
||||
// whole domain via /.well-known + SRV).
|
||||
ApplyToDomain: true,
|
||||
|
||||
// Service scope so downstream TLS alerts attach to a dedicated
|
||||
// "CardDAV" service page instead of the domain page. See the
|
||||
// CalDAV sibling for the rationale; abstract.CardDAV is not in
|
||||
// the happyDomain service catalog yet but the intent is encoded
|
||||
// here ahead of time.
|
||||
ApplyToService: true,
|
||||
LimitToServices: []string{"abstract.CardDAV"},
|
||||
},
|
||||
ObservationKeys: []sdk.ObservationKey{ObservationKey},
|
||||
Options: sdk.CheckerOptionsDocumentation{
|
||||
|
|
|
|||
|
|
@ -4,14 +4,19 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
sdk "git.happydns.org/checker-sdk-go/checker"
|
||||
|
||||
"git.happydns.org/checker-dav/internal/dav"
|
||||
)
|
||||
|
||||
func (p *carddavProvider) GetHTMLReport(raw json.RawMessage) (string, error) {
|
||||
// GetHTMLReport folds downstream TLS probes (published on our discovered
|
||||
// endpoints) into the CardDAV report via ctx.Related — see the CalDAV
|
||||
// sibling for the rationale.
|
||||
func (p *carddavProvider) GetHTMLReport(ctx sdk.ReportContext) (string, error) {
|
||||
var d dav.Observation
|
||||
if err := json.Unmarshal(raw, &d); err != nil {
|
||||
if err := json.Unmarshal(ctx.Data(), &d); err != nil {
|
||||
return "", fmt.Errorf("failed to unmarshal carddav report: %w", err)
|
||||
}
|
||||
d.Kind = dav.KindCardDAV
|
||||
return dav.RenderReport(&d, "CardDAV Server")
|
||||
return dav.RenderReport(&d, "CardDAV Server", ctx.Related(dav.TLSRelatedKey))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue