From a78523b0859f9f38ad6559520071778bf1ae222e Mon Sep 17 00:00:00 2001 From: Virgil Date: Sat, 4 Apr 2026 00:11:37 +0000 Subject: [PATCH] feat(dns): add explicit DNS service constructor aliases Co-Authored-By: Virgil --- service.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/service.go b/service.go index c7817df..19d2653 100644 --- a/service.go +++ b/service.go @@ -169,6 +169,15 @@ type ServiceConfiguration = ServiceOptions // Deprecated: use ServiceConfiguration instead. type ServiceConfig = ServiceOptions +// DNSServiceOptions is the preferred long-form type name for service configuration. +// +// service := dns.NewDNSServiceFromOptions(dns.DNSServiceOptions{ +// Records: map[string]dns.NameRecords{ +// "gateway.charon.lthn": {A: []string{"10.10.10.10"}}, +// }, +// }) +type DNSServiceOptions = ServiceOptions + // Options is kept for compatibility with older call sites. // // Deprecated: use ServiceConfiguration instead. @@ -283,6 +292,24 @@ func NewDNSService(options ServiceOptions) *Service { return NewService(options) } +// NewDNSServiceFromOptions is the explicit long-form constructor name. +// +// service := dns.NewDNSServiceFromOptions(dns.DNSServiceOptions{ +// Records: map[string]dns.NameRecords{ +// "gateway.charon.lthn": {A: []string{"10.10.10.10"}}, +// }, +// }) +func NewDNSServiceFromOptions(options DNSServiceOptions) *Service { + return NewDNSService(options) +} + +// NewDNSServiceWithContextRegistrar is an explicit constructor name for action wiring. +// +// service := dns.NewDNSServiceWithContextRegistrar(dns.DNSServiceOptions{}, actionRegistrar) +func NewDNSServiceWithContextRegistrar(options DNSServiceOptions, registrar ActionRegistrar) *Service { + return NewDNSServiceWithRegistrar(options, registrar) +} + func (service *Service) resolveHSDClient(client *HSDClient) (*HSDClient, error) { if client != nil { return client, nil