From dfae017ce573592c942696d1cd455fc47d13dba4 Mon Sep 17 00:00:00 2001 From: Virgil Date: Fri, 3 Apr 2026 22:26:04 +0000 Subject: [PATCH] Improve DNS service AX naming --- service.go | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/service.go b/service.go index 37c1b3e..375192e 100644 --- a/service.go +++ b/service.go @@ -121,18 +121,23 @@ type ServiceOptions struct { ActionRegistrar ActionRegistrar } -// Options is the documented constructor shape for NewService. +// ServiceConfig is the preferred constructor shape for NewService. // -// service := dns.NewService(dns.Options{ +// service := dns.NewService(dns.ServiceConfig{ // Records: map[string]dns.NameRecords{ // "gateway.charon.lthn": {A: []string{"10.10.10.10"}}, // }, // }) +type ServiceConfig = ServiceOptions + +// Options is kept for compatibility with older call sites. +// +// Deprecated: use ServiceConfig instead. type Options = ServiceOptions // NewService builds a DNS service from cached records and optional discovery hooks. // -// service := dns.NewService(dns.Options{ +// service := dns.NewService(dns.ServiceConfig{ // Records: map[string]dns.NameRecords{ // "gateway.charon.lthn": {A: []string{"10.10.10.10"}}, // }, @@ -1097,7 +1102,15 @@ func normalizeName(name string) string { // // fmt.Println(service) func (service *Service) String() string { - return fmt.Sprintf("dns.Service{records=%d}", len(service.records)) + service.mu.RLock() + defer service.mu.RUnlock() + + return fmt.Sprintf( + "dns.Service{records=%d zone_apex=%q tree_root=%q}", + len(service.records), + service.zoneApex, + service.treeRoot, + ) } // MergeRecords deduplicates and sorts record values before returning them. -- 2.45.3