feat: publish tls.endpoint.v1 discovery entry to enable GetRelated
This commit is contained in:
parent
97b2545e2d
commit
c6400c7773
4 changed files with 34 additions and 16 deletions
26
checker/discover.go
Normal file
26
checker/discover.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue