Debian Codegraph @

providers/dns/nearlyfreespeech/nearlyfreespeech.go

raw symbols SCIP
1 // Package nearlyfreespeech implements a DNS provider for solving the DNS-01 challenge using NearlyFreeSpeech.NET.
2 package nearlyfreespeechscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/
3
4 import (
5 "contextscip-go gomod github.com/golang/go/src go1.25.0 context/"
6 "errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/"
7 "fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/"
8 "net/httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/"
9 "timescip-go gomod github.com/golang/go/src go1.25.0 time/"
10
11 "github.com/go-acme/lego/v4/challengescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge`/"
12 "github.com/go-acme/lego/v4/challenge/dns01scip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/"
13 "github.com/go-acme/lego/v4/platform/config/envscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/config/env`/"
14 "github.com/go-acme/lego/v4/providers/dns/internal/clientdebugscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/internal/clientdebug`/"
15 "github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internalscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal`/"
16 )
17
18 // Environment variables names.
19 const (
20 envNamespacescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/envNamespace. = "NEARLYFREESPEECH_"
21
22 EnvLoginscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/EnvLogin. = envNamespacescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/envNamespace. + "LOGIN"
23 EnvAPIKeyscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/EnvAPIKey. = envNamespacescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/envNamespace. + "API_KEY"
24
25 EnvTTLscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/EnvTTL. = envNamespacescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/envNamespace. + "TTL"
26 EnvPropagationTimeoutscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/EnvPropagationTimeout. = envNamespacescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/envNamespace. + "PROPAGATION_TIMEOUT"
27 EnvPollingIntervalscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/EnvPollingInterval. = envNamespacescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/envNamespace. + "POLLING_INTERVAL"
28 EnvHTTPTimeoutscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/EnvHTTPTimeout. = envNamespacescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/envNamespace. + "HTTP_TIMEOUT"
29 EnvSequenceIntervalscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/EnvSequenceInterval. = envNamespacescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/envNamespace. + "SEQUENCE_INTERVAL"
30 )
31
32 var _ challengescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge`/.ProviderTimeoutscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge`/ProviderTimeout# = (*DNSProviderscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#)(nil)
33
34 // Config is used to configure the creation of the DNSProvider.
35 type Configscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config# struct {
36 APIKeyscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#APIKey. string
37 Loginscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#Login. string
38
39 TTLscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#TTL. int
40 PropagationTimeoutscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#PropagationTimeout. timescip-go gomod github.com/golang/go/src go1.25.0 time/.Durationscip-go gomod github.com/golang/go/src go1.25.0 time/Duration#
41 PollingIntervalscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#PollingInterval. timescip-go gomod github.com/golang/go/src go1.25.0 time/.Durationscip-go gomod github.com/golang/go/src go1.25.0 time/Duration#
42 SequenceIntervalscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#SequenceInterval. timescip-go gomod github.com/golang/go/src go1.25.0 time/.Durationscip-go gomod github.com/golang/go/src go1.25.0 time/Duration#
43 HTTPClientscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#HTTPClient. *httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Clientscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Client#
44 }
45
46 // NewDefaultConfig returns a default configuration for the DNSProvider.
47 func NewDefaultConfigscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/NewDefaultConfig().() *Configscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config# {
48 return &Configscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#{
49 TTLscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#TTL.: envscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/config/env`/.GetOrDefaultIntscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/config/env`/GetOrDefaultInt().(EnvTTLscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/EnvTTL., 3600),
50 PropagationTimeoutscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#PropagationTimeout.: envscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/config/env`/.GetOrDefaultSecondscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/config/env`/GetOrDefaultSecond().(EnvPropagationTimeoutscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/EnvPropagationTimeout., dns01scip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/.DefaultPropagationTimeoutscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/DefaultPropagationTimeout.),
51 PollingIntervalscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#PollingInterval.: envscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/config/env`/.GetOrDefaultSecondscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/config/env`/GetOrDefaultSecond().(EnvPollingIntervalscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/EnvPollingInterval., dns01scip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/.DefaultPollingIntervalscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/DefaultPollingInterval.),
52 SequenceIntervalscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#SequenceInterval.: envscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/config/env`/.GetOrDefaultSecondscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/config/env`/GetOrDefaultSecond().(EnvSequenceIntervalscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/EnvSequenceInterval., dns01scip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/.DefaultPropagationTimeoutscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/DefaultPropagationTimeout.),
53 HTTPClientscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#HTTPClient.: &httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.Clientscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Client#{
54 Timeoutscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/Client#Timeout.: envscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/config/env`/.GetOrDefaultSecondscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/config/env`/GetOrDefaultSecond().(EnvHTTPTimeoutscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/EnvHTTPTimeout., 30*timescip-go gomod github.com/golang/go/src go1.25.0 time/.Secondscip-go gomod github.com/golang/go/src go1.25.0 time/Second.),
55 },
56 }
57 }
58
59 // DNSProvider implements the challenge.Provider interface.
60 type DNSProviderscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider# struct {
61 configscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#config. *Configscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#
62 clientscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#client. *internalscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal`/.Clientscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal`/Client#
63 }
64
65 // NewDNSProvider returns a DNSProvider instance configured for NearlyFreeSpeech.NET.
66 // Credentials must be passed in the environment variable: NEARLYFREESPEECH_LOGIN, NEARLYFREESPEECH_API_KEY.
67 func NewDNSProviderscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/NewDNSProvider().() (*DNSProviderscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#, error) {
68 values, err := envscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/config/env`/.Getscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/config/env`/Get().(EnvAPIKeyscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/EnvAPIKey., EnvLoginscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/EnvLogin.)
69 if err != nil {
70 return nil, fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("nearlyfreespeech: %w", err)
71 }
72
73 config := NewDefaultConfigscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/NewDefaultConfig().()
74 config.APIKeyscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#APIKey. = values[EnvAPIKeyscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/EnvAPIKey.]
75 config.Loginscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#Login. = values[EnvLoginscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/EnvLogin.]
76
77 return NewDNSProviderConfigscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/NewDNSProviderConfig().(config)
78 }
79
80 // NewDNSProviderConfig return a DNSProvider instance configured for NearlyFreeSpeech.NET.
81 func NewDNSProviderConfigscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/NewDNSProviderConfig().(config *Configscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#) (*DNSProviderscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#, error) {
82 if config == nil {
83 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("nearlyfreespeech: the configuration of the DNS provider is nil")
84 }
85
86 if config.Loginscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#Login. == "" || config.APIKeyscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#APIKey. == "" {
87 return nil, errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Newscip-go gomod github.com/golang/go/src go1.25.0 errors/New().("nearlyfreespeech: API credentials are missing")
88 }
89
90 client := internalscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal`/.NewClientscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal`/NewClient().(config.Loginscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#Login., config.APIKeyscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#APIKey.)
91
92 if config.HTTPClientscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#HTTPClient. != nil {
93 client.HTTPClientscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal`/Client#HTTPClient. = config.HTTPClientscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#HTTPClient.
94 }
95
96 client.HTTPClientscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal`/Client#HTTPClient. = clientdebugscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/internal/clientdebug`/.Wrapscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/internal/clientdebug`/Wrap().(client.HTTPClientscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal`/Client#HTTPClient.)
97
98 return &DNSProviderscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#{
99 configscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#config.: config,
100 clientscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#client.: client,
101 }, nil
102 }
103
104 // Timeout returns the timeout and interval to use when checking for DNS propagation.
105 // Adjusting here to cope with spikes in propagation times.
106 func (d *DNSProviderscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#) Timeoutscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#Timeout().() (timeout, interval timescip-go gomod github.com/golang/go/src go1.25.0 time/.Durationscip-go gomod github.com/golang/go/src go1.25.0 time/Duration#) {
107 return d.configscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#config..PropagationTimeoutscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#PropagationTimeout., d.configscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#config..PollingIntervalscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#PollingInterval.
108 }
109
110 // Sequential All DNS challenges for this provider will be resolved sequentially.
111 // Returns the interval between each iteration.
112 func (d *DNSProviderscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#) Sequentialscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#Sequential().() timescip-go gomod github.com/golang/go/src go1.25.0 time/.Durationscip-go gomod github.com/golang/go/src go1.25.0 time/Duration# {
113 return d.configscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#config..SequenceIntervalscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#SequenceInterval.
114 }
115
116 // Present creates a TXT record to fulfill the dns-01 challenge.
117 func (d *DNSProviderscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#) Presentscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#Present().(domain, token, keyAuth string) error {
118 info := dns01scip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/.GetChallengeInfoscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/GetChallengeInfo().(domain, keyAuth)
119
120 authZone, err := dns01scip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/.FindZoneByFqdnscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/FindZoneByFqdn().(info.EffectiveFQDNscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/ChallengeInfo#EffectiveFQDN.)
121 if err != nil {
122 return fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("nearlyfreespeech: could not find zone for domain %q: %w", domain, err)
123 }
124
125 recordName, err := dns01scip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/.ExtractSubDomainscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/ExtractSubDomain().(info.EffectiveFQDNscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/ChallengeInfo#EffectiveFQDN., authZone)
126 if err != nil {
127 return fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("nearlyfreespeech: %w", err)
128 }
129
130 record := internalscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal`/.Recordscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal`/Record#{
131 Namescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal`/Record#Name.: recordName,
132 Typescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal`/Record#Type.: "TXT",
133 Datascip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal`/Record#Data.: info.Valuescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/ChallengeInfo#Value.,
134 TTLscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal`/Record#TTL.: d.configscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#config..TTLscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/Config#TTL.,
135 }
136
137 err = d.clientscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#client..AddRecordscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal`/Client#AddRecord().(contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Backgroundscip-go gomod github.com/golang/go/src go1.25.0 context/Background().(), authZone, record)
138 if err != nil {
139 return fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("nearlyfreespeech: %w", err)
140 }
141
142 return nil
143 }
144
145 // CleanUp removes the TXT record matching the specified parameters.
146 func (d *DNSProviderscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#) CleanUpscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#CleanUp().(domain, token, keyAuth string) error {
147 info := dns01scip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/.GetChallengeInfoscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/GetChallengeInfo().(domain, keyAuth)
148
149 authZone, err := dns01scip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/.FindZoneByFqdnscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/FindZoneByFqdn().(info.EffectiveFQDNscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/ChallengeInfo#EffectiveFQDN.)
150 if err != nil {
151 return fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("nearlyfreespeech: could not find zone for domain %q: %w", domain, err)
152 }
153
154 recordName, err := dns01scip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/.ExtractSubDomainscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/ExtractSubDomain().(info.EffectiveFQDNscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/ChallengeInfo#EffectiveFQDN., authZone)
155 if err != nil {
156 return fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("nearlyfreespeech: %w", err)
157 }
158
159 record := internalscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal`/.Recordscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal`/Record#{
160 Namescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal`/Record#Name.: recordName,
161 Typescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal`/Record#Type.: "TXT",
162 Datascip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal`/Record#Data.: info.Valuescip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/challenge/dns01`/ChallengeInfo#Value.,
163 }
164
165 err = d.clientscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech`/DNSProvider#client..RemoveRecordscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal`/Client#RemoveRecord().(contextscip-go gomod github.com/golang/go/src go1.25.0 context/.Backgroundscip-go gomod github.com/golang/go/src go1.25.0 context/Background().(), domain, record)
166 if err != nil {
167 return fmtscip-go gomod github.com/golang/go/src go1.25.0 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25.0 fmt/Errorf().("nearlyfreespeech: %w", err)
168 }
169
170 return nil
171 }