checker: build host FQDN from subdomain + apex at service scope

This commit is contained in:
nemunaire 2026-04-29 17:35:31 +07:00
commit 77f8ee4024
5 changed files with 31 additions and 7 deletions

View file

@ -21,6 +21,7 @@ import (
"time"
sdk "git.happydns.org/checker-sdk-go/checker"
happydns "git.happydns.org/happyDomain/model"
"golang.org/x/net/html"
)
@ -143,7 +144,22 @@ func buildTarget(ctx context.Context, opts sdk.CheckerOptions) (Target, error) {
userAgent = v
}
host, ips := addressesFromServer(server)
// Origin is the FQDN where the service is mounted: svc.Domain holds the
// subdomain (relative to apex; "@" for apex), and the domain_name
// autofill carries the zone apex.
apex := ""
if v, ok := sdk.GetOption[string](opts, OptionDomainName); ok {
apex = strings.TrimSuffix(v, ".")
}
subdomain := ""
if svc, ok := sdk.GetOption[happydns.ServiceMessage](opts, OptionService); ok {
subdomain = strings.TrimSuffix(svc.Domain, ".")
}
origin := sdk.JoinRelative(subdomain, apex)
host, ips := addressesFromServer(server, origin)
if host == "" {
host = origin
}
// abstract.Server only pins one A and one AAAA. Resolve the host to
// pick up any additional records the authoritative DNS exposes, so
// multi-IP deployments aren't silently under-probed. Failures are