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,6 +15,12 @@ import (
|
|||
// the endpoint was reached via SRV, we also surface each SRV target as its
|
||||
// own endpoint — those are the names operators actually need certificates on,
|
||||
// and they may differ from the queried domain.
|
||||
//
|
||||
// SNI is always populated (equal to Host for CalDAV/CardDAV, since — unlike
|
||||
// XMPP (RFC 6120 §13.7.2.1) — there is no mandated source-domain-vs-target
|
||||
// split: clients negotiate TLS for the hostname they connect to). We fill
|
||||
// the field unconditionally so consumers can rely on it being set, matching
|
||||
// the convention already used by the XMPP checker.
|
||||
func DiscoverEndpoints(obs *Observation) []sdk.DiscoveredEndpoint {
|
||||
if obs == nil || obs.Discovery.ContextURL == "" {
|
||||
return nil
|
||||
|
|
@ -22,7 +28,7 @@ func DiscoverEndpoints(obs *Observation) []sdk.DiscoveredEndpoint {
|
|||
var out []sdk.DiscoveredEndpoint
|
||||
seen := map[string]struct{}{}
|
||||
|
||||
add := func(host string, port uint16, sni string) {
|
||||
add := func(host string, port uint16) {
|
||||
if host == "" || port == 0 {
|
||||
return
|
||||
}
|
||||
|
|
@ -31,20 +37,17 @@ func DiscoverEndpoints(obs *Observation) []sdk.DiscoveredEndpoint {
|
|||
return
|
||||
}
|
||||
seen[key] = struct{}{}
|
||||
ep := sdk.DiscoveredEndpoint{
|
||||
out = append(out, sdk.DiscoveredEndpoint{
|
||||
Type: "tls",
|
||||
Host: host,
|
||||
Port: port,
|
||||
}
|
||||
if sni != "" && sni != host {
|
||||
ep.SNI = sni
|
||||
}
|
||||
out = append(out, ep)
|
||||
SNI: host,
|
||||
})
|
||||
}
|
||||
|
||||
// Primary endpoint: the resolved context URL.
|
||||
if host, port, ok := hostPortFromURL(obs.Discovery.ContextURL); ok {
|
||||
add(host, port, "")
|
||||
add(host, port)
|
||||
}
|
||||
|
||||
// Secondary endpoints: every TLS SRV target. Clients may connect to any
|
||||
|
|
@ -54,7 +57,7 @@ func DiscoverEndpoints(obs *Observation) []sdk.DiscoveredEndpoint {
|
|||
if port == 0 {
|
||||
port = 443
|
||||
}
|
||||
add(r.Target, port, "")
|
||||
add(r.Target, port)
|
||||
}
|
||||
|
||||
return out
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue