From 4e5bb7e3988acad4c78f78ef3f52ef405dce4981 Mon Sep 17 00:00:00 2001 From: Virgil Date: Fri, 3 Apr 2026 22:52:14 +0000 Subject: [PATCH] Align DNS package comments with AX principles --- action.go | 12 ++++++++---- service.go | 11 ++++++++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/action.go b/action.go index 38bb61e..1a281af 100644 --- a/action.go +++ b/action.go @@ -29,8 +29,8 @@ type ActionDefinition struct { // ActionRegistrar publishes DNS actions into another Core surface. // -// registrar.RegisterAction(ActionHealth, func(map[string]any) (any, bool, error) { -// return service.Health(), true, nil +// registrar.RegisterAction(ActionResolve, func(values map[string]any) (any, bool, error) { +// return service.ResolveAddress("gateway.charon.lthn") // }) type ActionRegistrar interface { RegisterAction(name string, invoke func(map[string]any) (any, bool, error)) @@ -38,7 +38,11 @@ type ActionRegistrar interface { // ActionCaller resolves named actions from another Core surface. // -// aliases, ok, err := caller.CallAction(context.Background(), "blockchain.chain.aliases", map[string]any{}) +// aliases, ok, err := caller.CallAction( +// context.Background(), +// "blockchain.chain.aliases", +// map[string]any{}, +// ) type ActionCaller interface { CallAction(ctx context.Context, name string, values map[string]any) (any, bool, error) } @@ -151,7 +155,7 @@ func (service *Service) RegisterActions(registrar ActionRegistrar) { // NewServiceWithRegistrar builds a DNS service and registers its actions in one step. // -// service := dns.NewServiceWithRegistrar(dns.ServiceOptions{}, registrar) +// service := dns.NewServiceWithRegistrar(dns.ServiceConfiguration{}, registrar) // // registrar now exposes dns.resolve, dns.resolve.txt, dns.resolve.all, dns.reverse, dns.serve, dns.health, dns.discover func NewServiceWithRegistrar(options ServiceOptions, registrar ActionRegistrar) *Service { if registrar != nil { diff --git a/service.go b/service.go index ffd4135..880e234 100644 --- a/service.go +++ b/service.go @@ -147,18 +147,23 @@ type ServiceOptions struct { ActionRegistrar ActionRegistrar } -// ServiceConfig is the preferred constructor shape for NewService. +// ServiceConfiguration is the preferred constructor shape for NewService. // -// service := dns.NewService(dns.ServiceConfig{ +// service := dns.NewService(dns.ServiceConfiguration{ // Records: map[string]dns.NameRecords{ // "gateway.charon.lthn": {A: []string{"10.10.10.10"}}, // }, // }) +type ServiceConfiguration = ServiceOptions + +// ServiceConfig is kept for compatibility with older call sites. +// +// Deprecated: use ServiceConfiguration instead. type ServiceConfig = ServiceOptions // Options is kept for compatibility with older call sites. // -// Deprecated: use ServiceConfig instead. +// Deprecated: use ServiceConfiguration instead. type Options = ServiceOptions // NewService builds a DNS service from cached records and optional discovery hooks. -- 2.45.3