checker-caa/checker/discover.go
Pierre-Olivier Mercier c6400c7773
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
feat: publish tls.endpoint.v1 discovery entry to enable GetRelated
2026-05-15 18:44:35 +08:00

26 lines
833 B
Go

package checker
import (
sdk "git.happydns.org/checker-sdk-go/checker"
tlscontract "git.happydns.org/checker-tls/contract"
)
// DiscoverEntries publishes one tls.endpoint.v1 entry for the domain's HTTPS
// endpoint so checker-tls probes it. Implements sdk.DiscoveryPublisher.
// On the next checker-tls run the engine will store a DiscoveryObservationRef
// linking its snapshot back to this checker; GetRelated("tls_probes") in the
// rule will then return the observed certificates.
func (p *caaProvider) DiscoverEntries(data any) ([]sdk.DiscoveryEntry, error) {
d, ok := data.(*CAAData)
if !ok || d == nil || d.Domain == "" {
return nil, nil
}
entry, err := tlscontract.NewEntry(tlscontract.TLSEndpoint{
Host: d.Domain,
Port: 443,
})
if err != nil {
return nil, err
}
return []sdk.DiscoveryEntry{entry}, nil
}