From 6043c9347ca44682aa5d01b0f8711d1f2192cba9 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Fri, 8 May 2020 19:35:25 +0200 Subject: [PATCH] chore: update linter. (#1145) --- .golangci.toml | 3 + acme/api/api.go | 2 +- acme/api/certificate.go | 2 +- acme/api/internal/nonces/nonce_manager.go | 2 +- acme/api/service.go | 6 +- acme/errors.go | 2 +- certcrypto/crypto.go | 2 +- challenge/dns01/cname.go | 2 +- challenge/dns01/dns_challenge.go | 4 +- challenge/dns01/dns_challenge_manual.go | 6 +- challenge/dns01/nameserver.go | 8 +-- challenge/http01/domain_matcher.go | 2 +- challenge/http01/http_challenge.go | 2 +- challenge/http01/http_challenge_server.go | 8 +-- challenge/resolver/prober.go | 2 +- cmd/account.go | 6 +- cmd/certs_storage.go | 2 +- cmd/cmd.go | 2 +- cmd/setup.go | 2 +- docs/content/dns/zz_gen_godaddy.md | 10 ++- lego/client.go | 6 +- lego/client_config.go | 2 +- platform/config/env/env.go | 2 +- providers/dns/acmedns/acmedns.go | 3 +- providers/dns/alidns/alidns.go | 9 +-- providers/dns/auroradns/auroradns.go | 10 +-- providers/dns/autodns/autodns.go | 21 +++++-- providers/dns/autodns/client.go | 4 +- providers/dns/azure/azure.go | 14 ++--- providers/dns/bindman/bindman.go | 7 +-- providers/dns/bluecat/bluecat.go | 11 ++-- providers/dns/bluecat/client.go | 25 ++++---- providers/dns/checkdomain/checkdomain.go | 15 +++-- providers/dns/checkdomain/client.go | 4 +- providers/dns/clouddns/clouddns.go | 5 +- providers/dns/cloudflare/cloudflare.go | 10 +-- providers/dns/cloudns/cloudns.go | 6 +- providers/dns/cloudns/internal/client.go | 46 +++++++------- providers/dns/cloudxns/cloudxns.go | 6 +- providers/dns/cloudxns/internal/client.go | 16 ++--- providers/dns/conoha/conoha.go | 11 ++-- providers/dns/constellix/constellix.go | 10 +-- providers/dns/constellix/internal/auth.go | 6 +- providers/dns/constellix/internal/model.go | 2 +- providers/dns/desec/desec.go | 2 +- providers/dns/desec/internal/client.go | 2 +- providers/dns/designate/designate.go | 10 +-- providers/dns/digitalocean/client.go | 2 +- providers/dns/digitalocean/digitalocean.go | 11 ++-- providers/dns/dns_providers.go | 2 +- providers/dns/dnsimple/dnsimple.go | 8 +-- providers/dns/dnsmadeeasy/dnsmadeeasy.go | 11 ++-- providers/dns/dnsmadeeasy/internal/client.go | 16 ++--- providers/dns/dnspod/dnspod.go | 6 +- providers/dns/dode/dode.go | 8 +-- providers/dns/dreamhost/client.go | 2 +- providers/dns/dreamhost/dreamhost.go | 10 +-- providers/dns/duckdns/client.go | 8 +-- providers/dns/duckdns/duckdns.go | 8 +-- providers/dns/dyn/client.go | 2 +- providers/dns/dyn/dyn.go | 13 ++-- providers/dns/dynu/dynu.go | 10 +-- providers/dns/dynu/internal/auth.go | 6 +- providers/dns/easydns/easydns.go | 10 +-- providers/dns/exec/exec.go | 7 +-- providers/dns/exoscale/exoscale.go | 10 +-- providers/dns/fastdns/fastdns.go | 10 +-- providers/dns/gandi/gandi.go | 10 ++- providers/dns/gandi/gandi_mock_test.go | 64 ++++++++++---------- providers/dns/gandi/gandi_test.go | 16 ++--- providers/dns/gandiv5/client.go | 4 +- providers/dns/gandiv5/gandiv5.go | 15 ++--- providers/dns/gcloud/googlecloud.go | 10 +-- providers/dns/glesys/glesys.go | 8 +-- providers/dns/godaddy/client.go | 2 +- providers/dns/godaddy/godaddy.go | 10 +-- providers/dns/godaddy/godaddy.toml | 6 ++ providers/dns/hetzner/hetzner.go | 2 +- providers/dns/hostingde/hostingde.go | 12 ++-- providers/dns/httpreq/httpreq.go | 10 +-- providers/dns/iij/iij.go | 14 ++--- providers/dns/internal/selectel/models.go | 2 +- providers/dns/inwx/inwx.go | 12 ++-- providers/dns/joker/client.go | 20 +++--- providers/dns/joker/joker.go | 7 +-- providers/dns/lightsail/lightsail.go | 10 +-- providers/dns/lightsail/mock_server_test.go | 2 +- providers/dns/linode/linode.go | 4 +- providers/dns/linodev4/linodev4.go | 4 +- providers/dns/liquidweb/liquidweb.go | 11 ++-- providers/dns/mydnsjp/mydnsjp.go | 10 +-- providers/dns/mythicbeasts/mythicbeasts.go | 13 ++-- providers/dns/namecheap/namecheap.go | 10 ++- providers/dns/namedotcom/namedotcom.go | 8 +-- providers/dns/namesilo/namesilo.go | 6 +- providers/dns/netcup/internal/client.go | 36 +++++------ providers/dns/netcup/netcup.go | 12 ++-- providers/dns/netlify/netlify.go | 2 +- providers/dns/nifcloud/internal/client.go | 4 +- providers/dns/nifcloud/nifcloud.go | 10 +-- providers/dns/ns1/ns1.go | 6 +- providers/dns/oraclecloud/oraclecloud.go | 10 +-- providers/dns/otc/mock_test.go | 18 +++--- providers/dns/otc/otc.go | 13 ++-- providers/dns/ovh/ovh.go | 18 +++--- providers/dns/pdns/pdns.go | 10 +-- providers/dns/rackspace/client.go | 30 ++++----- providers/dns/rackspace/rackspace.go | 13 ++-- providers/dns/regru/regru.go | 8 +-- providers/dns/rfc2136/rfc2136.go | 11 ++-- providers/dns/rimuhosting/rimuhosting.go | 10 +-- providers/dns/route53/mock_test.go | 4 +- providers/dns/route53/route53.go | 15 +++-- providers/dns/sakuracloud/sakuracloud.go | 9 +-- providers/dns/scaleway/internal/client.go | 2 +- providers/dns/scaleway/scaleway.go | 2 +- providers/dns/selectel/selectel.go | 2 +- providers/dns/servercow/internal/model.go | 2 +- providers/dns/servercow/servercow.go | 4 +- providers/dns/stackpath/client.go | 10 +-- providers/dns/stackpath/stackpath.go | 10 +-- providers/dns/transip/transip.go | 10 +-- providers/dns/vegadns/vegadns.go | 10 +-- providers/dns/versio/versio.go | 10 +-- providers/dns/vscale/vscale.go | 2 +- providers/dns/vultr/vultr.go | 6 +- providers/dns/yandex/yandex.go | 6 +- providers/dns/zoneee/zoneee.go | 12 ++-- providers/dns/zonomi/zonomi.go | 10 +-- providers/http/memcached/memcached.go | 8 +-- providers/http/webroot/webroot.go | 8 +-- 131 files changed, 579 insertions(+), 576 deletions(-) diff --git a/.golangci.toml b/.golangci.toml index 19f61e54..732e95f7 100644 --- a/.golangci.toml +++ b/.golangci.toml @@ -34,6 +34,9 @@ "stylecheck", "godox", "gomnd", + "testpackage", # not relevant + "nestif", # too many false-positive + "goerr113", # not relevant ] [issues] diff --git a/acme/api/api.go b/acme/api/api.go index a4993768..29b91536 100644 --- a/acme/api/api.go +++ b/acme/api/api.go @@ -143,7 +143,7 @@ func (a *Core) signEABContent(newAccountURL, kid string, hmac []byte) ([]byte, e return []byte(eabJWS.FullSerialize()), nil } -// GetKeyAuthorization Gets the key authorization +// GetKeyAuthorization Gets the key authorization. func (a *Core) GetKeyAuthorization(token string) (string, error) { return a.jws.GetKeyAuthorization(token) } diff --git a/acme/api/certificate.go b/acme/api/certificate.go index 51e0aae6..39decf8a 100644 --- a/acme/api/certificate.go +++ b/acme/api/certificate.go @@ -77,7 +77,7 @@ func (c *CertificateService) get(certURL string) ([]byte, string, error) { return cert, up, err } -// getIssuerFromLink requests the issuer certificate +// getIssuerFromLink requests the issuer certificate. func (c *CertificateService) getIssuerFromLink(up string) ([]byte, error) { if len(up) == 0 { return nil, nil diff --git a/acme/api/internal/nonces/nonce_manager.go b/acme/api/internal/nonces/nonce_manager.go index 8c7fb92e..0342af98 100644 --- a/acme/api/internal/nonces/nonce_manager.go +++ b/acme/api/internal/nonces/nonce_manager.go @@ -46,7 +46,7 @@ func (n *Manager) Push(nonce string) { n.nonces = append(n.nonces, nonce) } -// Nonce implement jose.NonceSource +// Nonce implement jose.NonceSource. func (n *Manager) Nonce() (string, error) { if nonce, ok := n.Pop(); ok { return nonce, nil diff --git a/acme/api/service.go b/acme/api/service.go index ff043bc7..d8bee4c7 100644 --- a/acme/api/service.go +++ b/acme/api/service.go @@ -9,7 +9,7 @@ type service struct { core *Core } -// getLink get a rel into the Link header +// getLink get a rel into the Link header. func getLink(header http.Header, rel string) string { var linkExpr = regexp.MustCompile(`<(.+?)>;\s*rel="(.+?)"`) @@ -26,7 +26,7 @@ func getLink(header http.Header, rel string) string { return "" } -// getLocation get the value of the header Location +// getLocation get the value of the header Location. func getLocation(resp *http.Response) string { if resp == nil { return "" @@ -35,7 +35,7 @@ func getLocation(resp *http.Response) string { return resp.Header.Get("Location") } -// getRetryAfter get the value of the header Retry-After +// getRetryAfter get the value of the header Retry-After. func getRetryAfter(resp *http.Response) string { if resp == nil { return "" diff --git a/acme/errors.go b/acme/errors.go index 02a7d92c..74aa959f 100644 --- a/acme/errors.go +++ b/acme/errors.go @@ -4,7 +4,7 @@ import ( "fmt" ) -// Errors types +// Errors types. const ( errNS = "urn:ietf:params:acme:error:" BadNonceErr = errNS + "badNonce" diff --git a/certcrypto/crypto.go b/certcrypto/crypto.go index 5274d957..d4024371 100644 --- a/certcrypto/crypto.go +++ b/certcrypto/crypto.go @@ -40,7 +40,7 @@ const ( OCSPServerFailed = ocsp.ServerFailed ) -// Constants for OCSP must staple +// Constants for OCSP must staple. var ( tlsFeatureExtensionOID = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 1, 24} ocspMustStapleFeature = []byte{0x30, 0x03, 0x02, 0x01, 0x05} diff --git a/challenge/dns01/cname.go b/challenge/dns01/cname.go index 619c8476..ab35ee84 100644 --- a/challenge/dns01/cname.go +++ b/challenge/dns01/cname.go @@ -2,7 +2,7 @@ package dns01 import "github.com/miekg/dns" -// Update FQDN with CNAME if any +// Update FQDN with CNAME if any. func updateDomainWithCName(r *dns.Msg, fqdn string) string { for _, rr := range r.Answer { if cn, ok := rr.(*dns.CNAME); ok { diff --git a/challenge/dns01/dns_challenge.go b/challenge/dns01/dns_challenge.go index 0c12a553..3df1608c 100644 --- a/challenge/dns01/dns_challenge.go +++ b/challenge/dns01/dns_challenge.go @@ -42,7 +42,7 @@ func CondOption(condition bool, opt ChallengeOption) ChallengeOption { return opt } -// Challenge implements the dns-01 challenge +// Challenge implements the dns-01 challenge. type Challenge struct { core *api.Core validate ValidateFunc @@ -169,7 +169,7 @@ type sequential interface { Sequential() time.Duration } -// GetRecord returns a DNS record which will fulfill the `dns-01` challenge +// GetRecord returns a DNS record which will fulfill the `dns-01` challenge. func GetRecord(domain, keyAuth string) (fqdn string, value string) { keyAuthShaBytes := sha256.Sum256([]byte(keyAuth)) // base64URL encoding without padding diff --git a/challenge/dns01/dns_challenge_manual.go b/challenge/dns01/dns_challenge_manual.go index 85da7d0e..b2f5d41f 100644 --- a/challenge/dns01/dns_challenge_manual.go +++ b/challenge/dns01/dns_challenge_manual.go @@ -11,7 +11,7 @@ const ( dnsTemplate = `%s %d IN TXT "%s"` ) -// DNSProviderManual is an implementation of the ChallengeProvider interface +// DNSProviderManual is an implementation of the ChallengeProvider interface. type DNSProviderManual struct{} // NewDNSProviderManual returns a DNSProviderManual instance. @@ -19,7 +19,7 @@ func NewDNSProviderManual() (*DNSProviderManual, error) { return &DNSProviderManual{}, nil } -// Present prints instructions for manually creating the TXT record +// Present prints instructions for manually creating the TXT record. func (*DNSProviderManual) Present(domain, token, keyAuth string) error { fqdn, value := GetRecord(domain, keyAuth) @@ -37,7 +37,7 @@ func (*DNSProviderManual) Present(domain, token, keyAuth string) error { return err } -// CleanUp prints instructions for manually removing the TXT record +// CleanUp prints instructions for manually removing the TXT record. func (*DNSProviderManual) CleanUp(domain, token, keyAuth string) error { fqdn, _ := GetRecord(domain, keyAuth) diff --git a/challenge/dns01/nameserver.go b/challenge/dns01/nameserver.go index e70db174..c1682b4d 100644 --- a/challenge/dns01/nameserver.go +++ b/challenge/dns01/nameserver.go @@ -26,10 +26,10 @@ var defaultNameservers = []string{ "google-public-dns-b.google.com:53", } -// recursiveNameservers are used to pre-check DNS propagation +// recursiveNameservers are used to pre-check DNS propagation. var recursiveNameservers = getNameservers(defaultResolvConf, defaultNameservers) -// soaCacheEntry holds a cached SOA record (only selected fields) +// soaCacheEntry holds a cached SOA record (only selected fields). type soaCacheEntry struct { zone string // zone apex (a domain name) primaryNs string // primary nameserver for the zone apex @@ -70,7 +70,7 @@ func AddRecursiveNameservers(nameservers []string) ChallengeOption { } } -// getNameservers attempts to get systems nameservers before falling back to the defaults +// getNameservers attempts to get systems nameservers before falling back to the defaults. func getNameservers(path string, defaults []string) []string { config, err := dns.ClientConfigFromFile(path) if err != nil || len(config.Servers) == 0 { @@ -215,7 +215,7 @@ func fetchSoaByFqdn(fqdn string, nameservers []string) (*soaCacheEntry, error) { return nil, fmt.Errorf("could not find the start of authority for %s%s", fqdn, formatDNSError(in, err)) } -// dnsMsgContainsCNAME checks for a CNAME answer in msg +// dnsMsgContainsCNAME checks for a CNAME answer in msg. func dnsMsgContainsCNAME(msg *dns.Msg) bool { for _, ans := range msg.Answer { if _, ok := ans.(*dns.CNAME); ok { diff --git a/challenge/http01/domain_matcher.go b/challenge/http01/domain_matcher.go index 9d3fc900..6ac6eab6 100644 --- a/challenge/http01/domain_matcher.go +++ b/challenge/http01/domain_matcher.go @@ -87,7 +87,7 @@ func (m *forwardedMatcher) matches(r *http.Request, domain string) bool { return strings.HasPrefix(host, domain) } -// parsing requires some form of state machine +// parsing requires some form of state machine. func parseForwardedHeader(s string) (elements []map[string]string, err error) { cur := make(map[string]string) key := "" diff --git a/challenge/http01/http_challenge.go b/challenge/http01/http_challenge.go index e6cc0d1b..7924b404 100644 --- a/challenge/http01/http_challenge.go +++ b/challenge/http01/http_challenge.go @@ -11,7 +11,7 @@ import ( type ValidateFunc func(core *api.Core, domain string, chlng acme.Challenge) error -// ChallengePath returns the URL path for the `http-01` challenge +// ChallengePath returns the URL path for the `http-01` challenge. func ChallengePath(token string) string { return "/.well-known/acme-challenge/" + token } diff --git a/challenge/http01/http_challenge_server.go b/challenge/http01/http_challenge_server.go index af5ab524..79442172 100644 --- a/challenge/http01/http_challenge_server.go +++ b/challenge/http01/http_challenge_server.go @@ -10,7 +10,7 @@ import ( "github.com/go-acme/lego/v3/log" ) -// ProviderServer implements ChallengeProvider for `http-01` challenge +// ProviderServer implements ChallengeProvider for `http-01` challenge. // It may be instantiated without using the NewProviderServer function if // you want only to use the default values. type ProviderServer struct { @@ -49,7 +49,7 @@ func (s *ProviderServer) GetAddress() string { return net.JoinHostPort(s.iface, s.port) } -// CleanUp closes the HTTP server and removes the token from `ChallengePath(token)` +// CleanUp closes the HTTP server and removes the token from `ChallengePath(token)`. func (s *ProviderServer) CleanUp(domain, token, keyAuth string) error { if s.listener == nil { return nil @@ -65,12 +65,12 @@ func (s *ProviderServer) CleanUp(domain, token, keyAuth string) error { // When the server runs behind a proxy server, this is not the correct place to look at; // Apache and NGINX have traditionally moved the original Host header into a new header named "X-Forwarded-Host". // Other webservers might use different names; -// and RFC7239 has standadized a new header named "Forwarded" (with slightly different semantics). +// and RFC7239 has standardized a new header named "Forwarded" (with slightly different semantics). // // The exact behavior depends on the value of headerName: // - "" (the empty string) and "Host" will restore the default and only check the Host header // - "Forwarded" will look for a Forwarded header, and inspect it according to https://tools.ietf.org/html/rfc7239 -// - any other value will check the header value with the same name +// - any other value will check the header value with the same name. func (s *ProviderServer) SetProxyHeader(headerName string) { switch h := textproto.CanonicalMIMEHeaderKey(headerName); h { case "", "Host": diff --git a/challenge/resolver/prober.go b/challenge/resolver/prober.go index d3c71e8d..60f3973b 100644 --- a/challenge/resolver/prober.go +++ b/challenge/resolver/prober.go @@ -29,7 +29,7 @@ type sequential interface { Sequential() (bool, time.Duration) } -// an authz with the solver we have chosen and the index of the challenge associated with it +// an authz with the solver we have chosen and the index of the challenge associated with it. type selectedAuthSolver struct { authz acme.Authorization solver solver diff --git a/cmd/account.go b/cmd/account.go index 60a56e13..902cf755 100644 --- a/cmd/account.go +++ b/cmd/account.go @@ -6,7 +6,7 @@ import ( "github.com/go-acme/lego/v3/registration" ) -// Account represents a users local saved credentials +// Account represents a users local saved credentials. type Account struct { Email string `json:"email"` Registration *registration.Resource `json:"registration"` @@ -15,7 +15,7 @@ type Account struct { /** Implementation of the registration.User interface **/ -// GetEmail returns the email address for the account +// GetEmail returns the email address for the account. func (a *Account) GetEmail() string { return a.Email } @@ -25,7 +25,7 @@ func (a *Account) GetPrivateKey() crypto.PrivateKey { return a.key } -// GetRegistration returns the server registration +// GetRegistration returns the server registration. func (a *Account) GetRegistration() *registration.Resource { return a.Registration } diff --git a/cmd/certs_storage.go b/cmd/certs_storage.go index 4a69125f..5e0b3c28 100644 --- a/cmd/certs_storage.go +++ b/cmd/certs_storage.go @@ -195,7 +195,7 @@ func (s *CertificatesStorage) MoveToArchive(domain string) error { return nil } -// sanitizedDomain Make sure no funny chars are in the cert names (like wildcards ;)) +// sanitizedDomain Make sure no funny chars are in the cert names (like wildcards ;)). func sanitizedDomain(domain string) string { safe, err := idna.ToASCII(strings.Replace(domain, "*", "_", -1)) if err != nil { diff --git a/cmd/cmd.go b/cmd/cmd.go index 2c63a5af..05b135f5 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -2,7 +2,7 @@ package cmd import "github.com/urfave/cli" -// CreateCommands Creates all CLI commands +// CreateCommands Creates all CLI commands. func CreateCommands() []cli.Command { return []cli.Command{ createRun(), diff --git a/cmd/setup.go b/cmd/setup.go index 7f9bf249..9b7c87e6 100644 --- a/cmd/setup.go +++ b/cmd/setup.go @@ -60,7 +60,7 @@ func newClient(ctx *cli.Context, acc registration.User, keyType certcrypto.KeyTy return client } -// getKeyType the type from which private keys should be generated +// getKeyType the type from which private keys should be generated. func getKeyType(ctx *cli.Context) certcrypto.KeyType { keyType := ctx.GlobalString("key-type") switch strings.ToUpper(keyType) { diff --git a/docs/content/dns/zz_gen_godaddy.md b/docs/content/dns/zz_gen_godaddy.md index a27f4ac4..84c23ce2 100644 --- a/docs/content/dns/zz_gen_godaddy.md +++ b/docs/content/dns/zz_gen_godaddy.md @@ -18,9 +18,13 @@ Configuration for [Go Daddy](https://godaddy.com). - Code: `godaddy` -{{% notice note %}} -_Please contribute by adding a CLI example._ -{{% /notice %}} +Here is an example bash command using the Go Daddy provider: + +```bash +GODADDY_API_KEY=xxxxxxxx \ +GODADDY_API_SECRET=yyyyyyyy \ +lego --dns godaddy --domains my.domain.com --email my@email.com run +``` diff --git a/lego/client.go b/lego/client.go index 751c5cd1..2051d12e 100644 --- a/lego/client.go +++ b/lego/client.go @@ -10,7 +10,7 @@ import ( "github.com/go-acme/lego/v3/registration" ) -// Client is the user-friendly way to ACME +// Client is the user-friendly way to ACME. type Client struct { Certificate *certificate.Certifier Challenge *resolver.SolverManager @@ -63,12 +63,12 @@ func NewClient(config *Config) (*Client, error) { }, nil } -// GetToSURL returns the current ToS URL from the Directory +// GetToSURL returns the current ToS URL from the Directory. func (c *Client) GetToSURL() string { return c.core.GetDirectory().Meta.TermsOfService } -// GetExternalAccountRequired returns the External Account Binding requirement of the Directory +// GetExternalAccountRequired returns the External Account Binding requirement of the Directory. func (c *Client) GetExternalAccountRequired() bool { return c.core.GetDirectory().Meta.ExternalAccountRequired } diff --git a/lego/client_config.go b/lego/client_config.go index 984ed249..49e3a8b8 100644 --- a/lego/client_config.go +++ b/lego/client_config.go @@ -61,7 +61,7 @@ type CertificateConfig struct { // createDefaultHTTPClient Creates an HTTP client with a reasonable timeout value // and potentially a custom *x509.CertPool -// based on the caCertificatesEnvVar environment variable (see the `initCertPool` function) +// based on the caCertificatesEnvVar environment variable (see the `initCertPool` function). func createDefaultHTTPClient() *http.Client { return &http.Client{ Transport: &http.Transport{ diff --git a/platform/config/env/env.go b/platform/config/env/env.go index dd86395b..ac060c6c 100644 --- a/platform/config/env/env.go +++ b/platform/config/env/env.go @@ -12,7 +12,7 @@ import ( "github.com/go-acme/lego/v3/log" ) -// Get environment variables +// Get environment variables. func Get(names ...string) (map[string]string, error) { values := map[string]string{} diff --git a/providers/dns/acmedns/acmedns.go b/providers/dns/acmedns/acmedns.go index 5dbdd2fd..766bd179 100644 --- a/providers/dns/acmedns/acmedns.go +++ b/providers/dns/acmedns/acmedns.go @@ -34,8 +34,7 @@ type acmeDNSClient interface { RegisterAccount([]string) (goacmedns.Account, error) } -// DNSProvider is an implementation of the challenge.Provider interface for -// an ACME-DNS server. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { client acmeDNSClient storage goacmedns.Storage diff --git a/providers/dns/alidns/alidns.go b/providers/dns/alidns/alidns.go index 21da91c2..06f09da0 100644 --- a/providers/dns/alidns/alidns.go +++ b/providers/dns/alidns/alidns.go @@ -32,7 +32,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { APIKey string SecretKey string @@ -43,7 +43,7 @@ type Config struct { HTTPTimeout time.Duration } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, 600), @@ -53,14 +53,15 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *alidns.Client } // NewDNSProvider returns a DNSProvider instance configured for Alibaba Cloud DNS. -// Credentials must be passed in the environment variables: ALICLOUD_ACCESS_KEY and ALICLOUD_SECRET_KEY. +// Credentials must be passed in the environment variables: +// ALICLOUD_ACCESS_KEY and ALICLOUD_SECRET_KEY. func NewDNSProvider() (*DNSProvider, error) { values, err := env.Get(EnvAccessKey, EnvSecretKey) if err != nil { diff --git a/providers/dns/auroradns/auroradns.go b/providers/dns/auroradns/auroradns.go index acd00e61..fdc8ad42 100644 --- a/providers/dns/auroradns/auroradns.go +++ b/providers/dns/auroradns/auroradns.go @@ -27,7 +27,7 @@ const ( EnvPollingInterval = envNamespace + "POLLING_INTERVAL" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { BaseURL string UserID string @@ -37,7 +37,7 @@ type Config struct { TTL int } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, 300), @@ -46,7 +46,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider describes a provider for AuroraDNS +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { recordIDs map[string]string recordIDsMu sync.Mutex @@ -102,7 +102,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { }, nil } -// Present creates a record with a secret +// Present creates a TXT record using the specified parameters. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -146,7 +146,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes a given record that was generated by Present +// CleanUp removes a given record that was generated by Present. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, _ := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/autodns/autodns.go b/providers/dns/autodns/autodns.go index 02c6b33c..078b27d1 100644 --- a/providers/dns/autodns/autodns.go +++ b/providers/dns/autodns/autodns.go @@ -1,3 +1,4 @@ +// Package autodns implements a DNS provider for solving the DNS-01 challenge using auto DNS. package autodns import ( @@ -31,6 +32,7 @@ const ( defaultTTL int = 600 ) +// Config is used to configure the creation of the DNSProvider. type Config struct { Endpoint *url.URL Username string @@ -42,6 +44,7 @@ type Config struct { HTTPClient *http.Client } +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { endpoint, _ := url.Parse(env.GetOrDefaultString(EnvAPIEndpoint, defaultEndpoint)) @@ -57,14 +60,13 @@ func NewDefaultConfig() *Config { } } +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config } -func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { - return d.config.PropagationTimeout, d.config.PollingInterval -} - +// NewDNSProvider returns a DNSProvider instance configured for autoDNS. +// Credentials must be passed in the environment variables. func NewDNSProvider() (*DNSProvider, error) { values, err := env.Get(EnvAPIUser, EnvAPIPassword) if err != nil { @@ -78,6 +80,7 @@ func NewDNSProvider() (*DNSProvider, error) { return NewDNSProviderConfig(config) } +// NewDNSProviderConfig return a DNSProvider instance configured for autoDNS. func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { if config == nil { return nil, errors.New("autodns: config is nil") @@ -94,7 +97,13 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { return &DNSProvider{config: config}, nil } -// Present creates a TXT record to fulfill the dns-01 challenge +// Timeout returns the timeout and interval to use when checking for DNS propagation. +// Adjusting here to cope with spikes in propagation times. +func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { + return d.config.PropagationTimeout, d.config.PollingInterval +} + +// Present creates a TXT record to fulfill the dns-01 challenge. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -113,7 +122,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record previously created +// CleanUp removes the TXT record previously created. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/autodns/client.go b/providers/dns/autodns/client.go index d8f163f0..e6fb591e 100644 --- a/providers/dns/autodns/client.go +++ b/providers/dns/autodns/client.go @@ -45,7 +45,7 @@ type DataZoneResponse struct { Data []*Zone `json:"data"` } -// ResourceRecord holds a resource record +// ResourceRecord holds a resource record. type ResourceRecord struct { Name string `json:"name"` TTL int64 `json:"ttl"` @@ -54,7 +54,7 @@ type ResourceRecord struct { Pref int32 `json:"pref,omitempty"` } -// Zone is an autodns zone record with all for us relevant fields +// Zone is an autodns zone record with all for us relevant fields. type Zone struct { Name string `json:"origin"` ResourceRecords []*ResourceRecord `json:"resourceRecords"` diff --git a/providers/dns/azure/azure.go b/providers/dns/azure/azure.go index 73b4561a..0995dcf1 100644 --- a/providers/dns/azure/azure.go +++ b/providers/dns/azure/azure.go @@ -37,7 +37,7 @@ const ( EnvPollingInterval = envNamespace + "POLLING_INTERVAL" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { // optional if using instance metadata service ClientID string @@ -55,7 +55,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, 60), @@ -65,7 +65,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config authorizer autorest.Authorizer @@ -136,7 +136,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// Present creates a TXT record to fulfill the dns-01 challenge +// Present creates a TXT record to fulfill the dns-01 challenge. func (d *DNSProvider) Present(domain, token, keyAuth string) error { ctx := context.Background() fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -191,7 +191,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { ctx := context.Background() fqdn, _ := dns01.GetRecord(domain, keyAuth) @@ -231,7 +231,7 @@ func (d *DNSProvider) getHostedZoneID(ctx context.Context, fqdn string) (string, return to.String(zone.Name), nil } -// Returns the relative record to the domain +// Returns the relative record to the domain. func toRelativeRecord(domain, zone string) string { return dns01.UnFqdn(strings.TrimSuffix(domain, zone)) } @@ -252,7 +252,7 @@ func getAuthorizer(config *Config) (autorest.Authorizer, error) { return auth.NewAuthorizerFromEnvironment() } -// Fetches metadata from environment or he instance metadata service +// Fetches metadata from environment or he instance metadata service. // borrowed from https://github.com/Microsoft/azureimds/blob/master/imdssample.go func getMetadata(config *Config, field string) (string, error) { metadataEndpoint := config.MetadataEndpoint diff --git a/providers/dns/bindman/bindman.go b/providers/dns/bindman/bindman.go index cb139f24..60191c31 100644 --- a/providers/dns/bindman/bindman.go +++ b/providers/dns/bindman/bindman.go @@ -23,7 +23,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { PropagationTimeout time.Duration PollingInterval time.Duration @@ -31,7 +31,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, dns01.DefaultPropagationTimeout), @@ -42,8 +42,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface that uses -// Bindman's Address Manager REST API to manage TXT records for a domain. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *client.DNSWebhookClient diff --git a/providers/dns/bluecat/bluecat.go b/providers/dns/bluecat/bluecat.go index 7e3fdcaa..f876fef8 100644 --- a/providers/dns/bluecat/bluecat.go +++ b/providers/dns/bluecat/bluecat.go @@ -37,7 +37,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { BaseURL string UserName string @@ -50,7 +50,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL), @@ -62,8 +62,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface that uses -// Bluecat's Address Manager REST API to manage TXT records for a domain. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config token string @@ -73,7 +72,7 @@ type DNSProvider struct { // Credentials must be passed in the environment variables: BLUECAT_SERVER_URL, BLUECAT_USER_NAME and BLUECAT_PASSWORD. // BLUECAT_SERVER_URL should have the scheme, hostname, and port (if required) of the authoritative Bluecat BAM server. // The REST endpoint will be appended. -// In addition, the Configuration name and external DNS View Name must be passed in BLUECAT_CONFIG_NAME and BLUECAT_DNS_VIEW +// In addition, the Configuration name and external DNS View Name must be passed in BLUECAT_CONFIG_NAME and BLUECAT_DNS_VIEW. func NewDNSProvider() (*DNSProvider, error) { values, err := env.Get(EnvServerURL, EnvUserName, EnvPassword, EnvConfigName, EnvDNSView) if err != nil { @@ -156,7 +155,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return d.logout() } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, _ := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/bluecat/client.go b/providers/dns/bluecat/client.go index c0d9e1b2..711cf80f 100644 --- a/providers/dns/bluecat/client.go +++ b/providers/dns/bluecat/client.go @@ -11,7 +11,7 @@ import ( "strings" ) -// JSON body for Bluecat entity requests and responses +// JSON body for Bluecat entity requests and responses. type bluecatEntity struct { ID string `json:"id,omitempty"` Name string `json:"name"` @@ -26,8 +26,9 @@ type entityResponse struct { Properties string `json:"properties"` } -// Starts a new Bluecat API Session. Authenticates using customerName, userName, -// password and receives a token to be used in for subsequent requests. +// Starts a new Bluecat API Session. +// Authenticates using customerName, userName, password, +// and receives a token to be used in for subsequent requests. func (d *DNSProvider) login() error { queryArgs := map[string]string{ "username": d.config.UserName, @@ -56,7 +57,7 @@ func (d *DNSProvider) login() error { return nil } -// Destroys Bluecat Session +// Destroys Bluecat Session. func (d *DNSProvider) logout() error { if len(d.token) == 0 { // nothing to do @@ -89,7 +90,7 @@ func (d *DNSProvider) logout() error { return nil } -// Lookup the entity ID of the configuration named in our properties +// Lookup the entity ID of the configuration named in our properties. func (d *DNSProvider) lookupConfID() (uint, error) { queryArgs := map[string]string{ "parentId": strconv.Itoa(0), @@ -111,7 +112,7 @@ func (d *DNSProvider) lookupConfID() (uint, error) { return conf.ID, nil } -// Find the DNS view with the given name within +// Find the DNS view with the given name within. func (d *DNSProvider) lookupViewID(viewName string) (uint, error) { confID, err := d.lookupConfID() if err != nil { @@ -139,8 +140,8 @@ func (d *DNSProvider) lookupViewID(viewName string) (uint, error) { return view.ID, nil } -// Return the entityId of the parent zone by recursing from the root view -// Also return the simple name of the host +// Return the entityId of the parent zone by recursing from the root view. +// Also return the simple name of the host. func (d *DNSProvider) lookupParentZoneID(viewID uint, fqdn string) (uint, string, error) { parentViewID := viewID name := "" @@ -165,7 +166,7 @@ func (d *DNSProvider) lookupParentZoneID(viewID uint, fqdn string) (uint, string return parentViewID, name, nil } -// Get the DNS zone with the specified name under the parentId +// Get the DNS zone with the specified name under the parentId. func (d *DNSProvider) getZone(parentID uint, name string) (uint, error) { queryArgs := map[string]string{ "parentId": strconv.FormatUint(uint64(parentID), 10), @@ -193,7 +194,7 @@ func (d *DNSProvider) getZone(parentID uint, name string) (uint, error) { return zone.ID, nil } -// Deploy the DNS config for the specified entity to the authoritative servers +// Deploy the DNS config for the specified entity to the authoritative servers. func (d *DNSProvider) deploy(entityID uint) error { queryArgs := map[string]string{ "entityId": strconv.FormatUint(uint64(entityID), 10), @@ -208,8 +209,8 @@ func (d *DNSProvider) deploy(entityID uint) error { return nil } -// Send a REST request, using query parameters specified. The Authorization -// header will be set if we have an active auth token +// Send a REST request, using query parameters specified. +// The Authorization header will be set if we have an active auth token. func (d *DNSProvider) sendRequest(method, resource string, payload interface{}, queryArgs map[string]string) (*http.Response, error) { url := fmt.Sprintf("%s/Services/REST/v1/%s", d.config.BaseURL, resource) diff --git a/providers/dns/checkdomain/checkdomain.go b/providers/dns/checkdomain/checkdomain.go index 399031c6..452b6313 100644 --- a/providers/dns/checkdomain/checkdomain.go +++ b/providers/dns/checkdomain/checkdomain.go @@ -1,3 +1,4 @@ +// Package checkdomain implements a DNS provider for solving the DNS-01 challenge using CheckDomain DNS. package checkdomain import ( @@ -30,7 +31,7 @@ const ( defaultTTL = 300 ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { Endpoint *url.URL Token string @@ -40,7 +41,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, defaultTTL), @@ -52,8 +53,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider implements challenge.Provider for the checkdomain API -// specified at https://developer.checkdomain.de/reference/. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config @@ -61,6 +61,7 @@ type DNSProvider struct { domainIDMapping map[string]int } +// NewDNSProvider returns a DNSProvider instance configured for CheckDomain. func NewDNSProvider() (*DNSProvider, error) { values, err := env.Get(EnvToken) if err != nil { @@ -98,7 +99,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { }, nil } -// Present creates a TXT record to fulfill the dns-01 challenge +// Present creates a TXT record to fulfill the dns-01 challenge. func (d *DNSProvider) Present(domain, token, keyAuth string) error { domainID, err := d.getDomainIDByName(domain) if err != nil { @@ -126,7 +127,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record previously created +// CleanUp removes the TXT record previously created. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { domainID, err := d.getDomainIDByName(domain) if err != nil { @@ -152,6 +153,8 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { return nil } +// Timeout returns the timeout and interval to use when checking for DNS propagation. +// Adjusting here to cope with spikes in propagation times. func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } diff --git a/providers/dns/checkdomain/client.go b/providers/dns/checkdomain/client.go index db59fa84..eb627807 100644 --- a/providers/dns/checkdomain/client.go +++ b/providers/dns/checkdomain/client.go @@ -19,10 +19,10 @@ const ( const domainNotFound = -1 -// max page limit that the checkdomain api allows +// max page limit that the checkdomain api allows. const maxLimit = 100 -// max integer value +// max integer value. const maxInt = int((^uint(0)) >> 1) type ( diff --git a/providers/dns/clouddns/clouddns.go b/providers/dns/clouddns/clouddns.go index df395530..e6b618b7 100644 --- a/providers/dns/clouddns/clouddns.go +++ b/providers/dns/clouddns/clouddns.go @@ -50,8 +50,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge. Provider interface -// that uses CloudDNS API to manage TXT records for a domain. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { client *internal.Client config *Config @@ -74,7 +73,7 @@ func NewDNSProvider() (*DNSProvider, error) { return NewDNSProviderConfig(config) } -// NewDNSProviderConfig return a DNSProvider instance configured for CloudDNS +// NewDNSProviderConfig return a DNSProvider instance configured for CloudDNS. func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { if config == nil { return nil, errors.New("clouddns: the configuration of the DNS provider is nil") diff --git a/providers/dns/cloudflare/cloudflare.go b/providers/dns/cloudflare/cloudflare.go index bf686ade..b1ead479 100644 --- a/providers/dns/cloudflare/cloudflare.go +++ b/providers/dns/cloudflare/cloudflare.go @@ -18,7 +18,7 @@ const ( minTTL = 120 ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { AuthEmail string AuthKey string @@ -32,7 +32,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt("CLOUDFLARE_TTL", minTTL), @@ -44,7 +44,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { client *metaClient config *Config @@ -118,7 +118,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// Present creates a TXT record to fulfill the dns-01 challenge +// Present creates a TXT record to fulfill the dns-01 challenge. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -157,7 +157,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, _ := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/cloudns/cloudns.go b/providers/dns/cloudns/cloudns.go index 73587797..7682c387 100644 --- a/providers/dns/cloudns/cloudns.go +++ b/providers/dns/cloudns/cloudns.go @@ -26,7 +26,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { AuthID string SubAuthID string @@ -37,7 +37,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, 60), @@ -49,7 +49,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *internal.Client diff --git a/providers/dns/cloudns/internal/client.go b/providers/dns/cloudns/internal/client.go index c547c770..9847c497 100644 --- a/providers/dns/cloudns/internal/client.go +++ b/providers/dns/cloudns/internal/client.go @@ -27,7 +27,7 @@ type Zone struct { Status string // is an integer, but cast as string } -// TXTRecord a TXT record +// TXTRecord a TXT record. type TXTRecord struct { ID int `json:"id,string"` Type string `json:"type"` @@ -40,7 +40,7 @@ type TXTRecord struct { type TXTRecords map[string]TXTRecord -// NewClient creates a ClouDNS client +// NewClient creates a ClouDNS client. func NewClient(authID string, subAuthID string, authPassword string) (*Client, error) { if authID == "" && subAuthID == "" { return nil, errors.New("credentials missing: authID or subAuthID") @@ -64,7 +64,7 @@ func NewClient(authID string, subAuthID string, authPassword string) (*Client, e }, nil } -// Client ClouDNS client +// Client ClouDNS client. type Client struct { authID string subAuthID string @@ -73,7 +73,7 @@ type Client struct { BaseURL *url.URL } -// GetZone Get domain name information for a FQDN +// GetZone Get domain name information for a FQDN. func (c *Client) GetZone(authFQDN string) (*Zone, error) { authZone, err := dns01.FindZoneByFqdn(authFQDN) if err != nil { @@ -109,7 +109,7 @@ func (c *Client) GetZone(authFQDN string) (*Zone, error) { return nil, fmt.Errorf("zone %s not found for authFQDN %s", authZoneName, authFQDN) } -// FindTxtRecord return the TXT record a zone ID and a FQDN +// FindTxtRecord return the TXT record a zone ID and a FQDN. func (c *Client) FindTxtRecord(zoneName, fqdn string) (*TXTRecord, error) { host := dns01.UnFqdn(strings.TrimSuffix(dns01.UnFqdn(fqdn), zoneName)) @@ -146,7 +146,7 @@ func (c *Client) FindTxtRecord(zoneName, fqdn string) (*TXTRecord, error) { return nil, nil } -// AddTxtRecord add a TXT record +// AddTxtRecord add a TXT record. func (c *Client) AddTxtRecord(zoneName string, fqdn, value string, ttl int) error { host := dns01.UnFqdn(strings.TrimSuffix(dns01.UnFqdn(fqdn), zoneName)) @@ -178,7 +178,7 @@ func (c *Client) AddTxtRecord(zoneName string, fqdn, value string, ttl int) erro return nil } -// RemoveTxtRecord remove a TXT record +// RemoveTxtRecord remove a TXT record. func (c *Client) RemoveTxtRecord(recordID int, zoneName string) error { reqURL := *c.BaseURL reqURL.Path += "delete-record.json" @@ -254,21 +254,23 @@ func toUnreadableBodyMessage(req *http.Request, rawBody []byte) string { return fmt.Sprintf("the request %s sent a response with a body which is an invalid format: %q", req.URL, string(rawBody)) } -// https://www.cloudns.net/wiki/article/58/ -// Available TTL's: -// 60 = 1 minute -// 300 = 5 minutes -// 900 = 15 minutes -// 1800 = 30 minutes -// 3600 = 1 hour -// 21600 = 6 hours -// 43200 = 12 hours -// 86400 = 1 day -// 172800 = 2 days -// 259200 = 3 days -// 604800 = 1 week -// 1209600 = 2 weeks -// 2592000 = 1 month +// Rounds the given TTL in seconds to the next accepted value. +// Accepted TTL values are: +// - 60 = 1 minute +// - 300 = 5 minutes +// - 900 = 15 minutes +// - 1800 = 30 minutes +// - 3600 = 1 hour +// - 21600 = 6 hours +// - 43200 = 12 hours +// - 86400 = 1 day +// - 172800 = 2 days +// - 259200 = 3 days +// - 604800 = 1 week +// - 1209600 = 2 weeks +// - 2592000 = 1 month +// - 2592000 = 1 month +// See https://www.cloudns.net/wiki/article/58/ for details. func ttlRounder(ttl int) int { for _, validTTL := range []int{60, 300, 900, 1800, 3600, 21600, 43200, 86400, 172800, 259200, 604800, 1209600} { if ttl <= validTTL { diff --git a/providers/dns/cloudxns/cloudxns.go b/providers/dns/cloudxns/cloudxns.go index f4ccd7bd..a57aec8c 100644 --- a/providers/dns/cloudxns/cloudxns.go +++ b/providers/dns/cloudxns/cloudxns.go @@ -25,7 +25,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { APIKey string SecretKey string @@ -35,7 +35,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, dns01.DefaultPropagationTimeout), @@ -47,7 +47,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *internal.Client diff --git a/providers/dns/cloudxns/internal/client.go b/providers/dns/cloudxns/internal/client.go index e2ef063a..b13a6521 100644 --- a/providers/dns/cloudxns/internal/client.go +++ b/providers/dns/cloudxns/internal/client.go @@ -24,14 +24,14 @@ type apiResponse struct { Data json.RawMessage `json:"data,omitempty"` } -// Data Domain information +// Data Domain information. type Data struct { ID string `json:"id"` Domain string `json:"domain"` TTL int `json:"ttl,omitempty"` } -// TXTRecord a TXT record +// TXTRecord a TXT record. type TXTRecord struct { ID int `json:"domain_id,omitempty"` RecordID string `json:"record_id,omitempty"` @@ -43,7 +43,7 @@ type TXTRecord struct { TTL int `json:"ttl,string"` } -// NewClient creates a CloudXNS client +// NewClient creates a CloudXNS client. func NewClient(apiKey string, secretKey string) (*Client, error) { if apiKey == "" { return nil, errors.New("CloudXNS: credentials missing: apiKey") @@ -61,7 +61,7 @@ func NewClient(apiKey string, secretKey string) (*Client, error) { }, nil } -// Client CloudXNS client +// Client CloudXNS client. type Client struct { apiKey string secretKey string @@ -69,7 +69,7 @@ type Client struct { BaseURL string } -// GetDomainInformation Get domain name information for a FQDN +// GetDomainInformation Get domain name information for a FQDN. func (c *Client) GetDomainInformation(fqdn string) (*Data, error) { authZone, err := dns01.FindZoneByFqdn(fqdn) if err != nil { @@ -98,7 +98,7 @@ func (c *Client) GetDomainInformation(fqdn string) (*Data, error) { return nil, fmt.Errorf("CloudXNS: zone %s not found for domain %s", authZone, fqdn) } -// FindTxtRecord return the TXT record a zone ID and a FQDN +// FindTxtRecord return the TXT record a zone ID and a FQDN. func (c *Client) FindTxtRecord(zoneID, fqdn string) (*TXTRecord, error) { result, err := c.doRequest(http.MethodGet, fmt.Sprintf("record/%s?host_id=0&offset=0&row_num=2000", zoneID), nil) if err != nil { @@ -120,7 +120,7 @@ func (c *Client) FindTxtRecord(zoneID, fqdn string) (*TXTRecord, error) { return nil, fmt.Errorf("CloudXNS: no existing record found for %q", fqdn) } -// AddTxtRecord add a TXT record +// AddTxtRecord add a TXT record. func (c *Client) AddTxtRecord(info *Data, fqdn, value string, ttl int) error { id, err := strconv.Atoi(info.ID) if err != nil { @@ -145,7 +145,7 @@ func (c *Client) AddTxtRecord(info *Data, fqdn, value string, ttl int) error { return err } -// RemoveTxtRecord remove a TXT record +// RemoveTxtRecord remove a TXT record. func (c *Client) RemoveTxtRecord(recordID, zoneID string) error { _, err := c.doRequest(http.MethodDelete, fmt.Sprintf("record/%s/%s", recordID, zoneID), nil) return err diff --git a/providers/dns/conoha/conoha.go b/providers/dns/conoha/conoha.go index 3fed330f..99249add 100644 --- a/providers/dns/conoha/conoha.go +++ b/providers/dns/conoha/conoha.go @@ -27,7 +27,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { Region string TenantID string @@ -39,7 +39,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ Region: env.GetOrDefaultString(EnvRegion, "tyo1"), @@ -52,14 +52,15 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *internal.Client } // NewDNSProvider returns a DNSProvider instance configured for ConoHa DNS. -// Credentials must be passed in the environment variables: CONOHA_TENANT_ID, CONOHA_API_USERNAME, CONOHA_API_PASSWORD +// Credentials must be passed in the environment variables: +// CONOHA_TENANT_ID, CONOHA_API_USERNAME, CONOHA_API_PASSWORD. func NewDNSProvider() (*DNSProvider, error) { values, err := env.Get(EnvTenantID, EnvAPIUsername, EnvAPIPassword) if err != nil { @@ -129,7 +130,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp clears ConoHa DNS TXT record +// CleanUp clears ConoHa DNS TXT record. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/constellix/constellix.go b/providers/dns/constellix/constellix.go index a9bc2304..324f13b4 100644 --- a/providers/dns/constellix/constellix.go +++ b/providers/dns/constellix/constellix.go @@ -25,7 +25,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { APIKey string SecretKey string @@ -35,7 +35,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, 300), @@ -47,7 +47,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *internal.Client @@ -95,7 +95,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// Present creates a TXT record using the specified parameters +// Present creates a TXT record using the specified parameters. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -157,7 +157,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/constellix/internal/auth.go b/providers/dns/constellix/internal/auth.go index abdb7602..60619c5f 100644 --- a/providers/dns/constellix/internal/auth.go +++ b/providers/dns/constellix/internal/auth.go @@ -35,7 +35,7 @@ func NewTokenTransport(apiKey, secretKey string) (*TokenTransport, error) { return &TokenTransport{apiKey: apiKey, secretKey: secretKey}, nil } -// RoundTrip executes a single HTTP transaction +// RoundTrip executes a single HTTP transaction. func (t *TokenTransport) RoundTrip(req *http.Request) (*http.Response, error) { enrichedReq := &http.Request{} *enrichedReq = *req @@ -60,12 +60,12 @@ func (t *TokenTransport) transport() http.RoundTripper { return http.DefaultTransport } -// Client Creates a new HTTP client +// Client Creates a new HTTP client. func (t *TokenTransport) Client() *http.Client { return &http.Client{Transport: t} } -// Wrap Wrap a HTTP client Transport with the TokenTransport +// Wrap Wrap a HTTP client Transport with the TokenTransport. func (t *TokenTransport) Wrap(client *http.Client) *http.Client { backup := client.Transport t.Transport = backup diff --git a/providers/dns/constellix/internal/model.go b/providers/dns/constellix/internal/model.go index 47258ac2..c1218f96 100644 --- a/providers/dns/constellix/internal/model.go +++ b/providers/dns/constellix/internal/model.go @@ -5,7 +5,7 @@ import ( "strings" ) -// Search filters +// Search filters. const ( StartsWith searchFilter = "startswith" Exact searchFilter = "exact" diff --git a/providers/dns/desec/desec.go b/providers/dns/desec/desec.go index 0cf4fd41..87db9070 100644 --- a/providers/dns/desec/desec.go +++ b/providers/dns/desec/desec.go @@ -45,7 +45,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *internal.Client diff --git a/providers/dns/desec/internal/client.go b/providers/dns/desec/internal/client.go index fa4662b2..cbd260bd 100644 --- a/providers/dns/desec/internal/client.go +++ b/providers/dns/desec/internal/client.go @@ -20,7 +20,7 @@ type Client struct { token string } -// NewClient creats a new Client. +// NewClient creates a new Client. func NewClient(token string) *Client { return &Client{ HTTPClient: http.DefaultClient, diff --git a/providers/dns/designate/designate.go b/providers/dns/designate/designate.go index 6fa197ae..b019e02b 100644 --- a/providers/dns/designate/designate.go +++ b/providers/dns/designate/designate.go @@ -35,7 +35,7 @@ const ( EnvProjectID = envNamespaceClient + "PROJECT_ID" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { PropagationTimeout time.Duration PollingInterval time.Duration @@ -43,7 +43,7 @@ type Config struct { opts gophercloud.AuthOptions } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, 10), @@ -52,7 +52,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider describes a provider for Designate +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *gophercloud.ServiceClient @@ -106,7 +106,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// Present creates a TXT record to fulfill the dns-01 challenge +// Present creates a TXT record to fulfill the dns-01 challenge. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -146,7 +146,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, _ := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/digitalocean/client.go b/providers/dns/digitalocean/client.go index 8506bea9..3f2bfd20 100644 --- a/providers/dns/digitalocean/client.go +++ b/providers/dns/digitalocean/client.go @@ -14,7 +14,7 @@ import ( const defaultBaseURL = "https://api.digitalocean.com" -// txtRecordResponse represents a response from DO's API after making a TXT record +// txtRecordResponse represents a response from DO's API after making a TXT record. type txtRecordResponse struct { DomainRecord record `json:"domain_record"` } diff --git a/providers/dns/digitalocean/digitalocean.go b/providers/dns/digitalocean/digitalocean.go index 1e668424..479297bb 100644 --- a/providers/dns/digitalocean/digitalocean.go +++ b/providers/dns/digitalocean/digitalocean.go @@ -24,7 +24,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { BaseURL string AuthToken string @@ -34,7 +34,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ BaseURL: defaultBaseURL, @@ -47,8 +47,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface -// that uses DigitalOcean's REST API to manage TXT records for a domain. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config recordIDs map[string]int @@ -96,7 +95,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// Present creates a TXT record using the specified parameters +// Present creates a TXT record using the specified parameters. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -112,7 +111,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, _ := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/dns_providers.go b/providers/dns/dns_providers.go index a7745c00..753c52e8 100644 --- a/providers/dns/dns_providers.go +++ b/providers/dns/dns_providers.go @@ -82,7 +82,7 @@ import ( "github.com/go-acme/lego/v3/providers/dns/zonomi" ) -// NewDNSChallengeProviderByName Factory for DNS providers +// NewDNSChallengeProviderByName Factory for DNS providers. func NewDNSChallengeProviderByName(name string) (challenge.Provider, error) { switch name { case "acme-dns": diff --git a/providers/dns/dnsimple/dnsimple.go b/providers/dns/dnsimple/dnsimple.go index b729b4a8..72992c0a 100644 --- a/providers/dns/dnsimple/dnsimple.go +++ b/providers/dns/dnsimple/dnsimple.go @@ -27,7 +27,7 @@ const ( EnvPollingInterval = envNamespace + "POLLING_INTERVAL" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { AccessToken string BaseURL string @@ -36,7 +36,7 @@ type Config struct { TTL int } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL), @@ -45,14 +45,14 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *dnsimple.Client } // NewDNSProvider returns a DNSProvider instance configured for dnsimple. -// Credentials must be passed in the environment variables: DNSIMPLE_OAUTH_TOKEN. +// Credentials must be passed in the environment variable: DNSIMPLE_OAUTH_TOKEN. // // See: https://developer.dnsimple.com/v2/#authentication func NewDNSProvider() (*DNSProvider, error) { diff --git a/providers/dns/dnsmadeeasy/dnsmadeeasy.go b/providers/dns/dnsmadeeasy/dnsmadeeasy.go index 6a7acb64..b11124a2 100644 --- a/providers/dns/dnsmadeeasy/dnsmadeeasy.go +++ b/providers/dns/dnsmadeeasy/dnsmadeeasy.go @@ -28,7 +28,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { BaseURL string APIKey string @@ -40,7 +40,7 @@ type Config struct { TTL int } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL), @@ -55,8 +55,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface that uses -// DNSMadeEasy's DNS API to manage TXT records for a domain. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *internal.Client @@ -110,7 +109,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { }, nil } -// Present creates a TXT record using the specified parameters +// Present creates a TXT record using the specified parameters. func (d *DNSProvider) Present(domainName, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domainName, keyAuth) @@ -136,7 +135,7 @@ func (d *DNSProvider) Present(domainName, token, keyAuth string) error { return nil } -// CleanUp removes the TXT records matching the specified parameters +// CleanUp removes the TXT records matching the specified parameters. func (d *DNSProvider) CleanUp(domainName, token, keyAuth string) error { fqdn, _ := dns01.GetRecord(domainName, keyAuth) diff --git a/providers/dns/dnsmadeeasy/internal/client.go b/providers/dns/dnsmadeeasy/internal/client.go index e1a6615e..1fdb1606 100644 --- a/providers/dns/dnsmadeeasy/internal/client.go +++ b/providers/dns/dnsmadeeasy/internal/client.go @@ -13,13 +13,13 @@ import ( "time" ) -// Domain holds the DNSMadeEasy API representation of a Domain +// Domain holds the DNSMadeEasy API representation of a Domain. type Domain struct { ID int `json:"id"` Name string `json:"name"` } -// Record holds the DNSMadeEasy API representation of a Domain Record +// Record holds the DNSMadeEasy API representation of a Domain Record. type Record struct { ID int `json:"id"` Type string `json:"type"` @@ -33,7 +33,7 @@ type recordsResponse struct { Records *[]Record `json:"data"` } -// Client DNSMadeEasy client +// Client DNSMadeEasy client. type Client struct { apiKey string apiSecret string @@ -41,7 +41,7 @@ type Client struct { HTTPClient *http.Client } -// NewClient creates a DNSMadeEasy client +// NewClient creates a DNSMadeEasy client. func NewClient(apiKey string, apiSecret string) (*Client, error) { if apiKey == "" { return nil, errors.New("credentials missing: API key") @@ -58,7 +58,7 @@ func NewClient(apiKey string, apiSecret string) (*Client, error) { }, nil } -// GetDomain gets a domain +// GetDomain gets a domain. func (c *Client) GetDomain(authZone string) (*Domain, error) { domainName := authZone[0 : len(authZone)-1] resource := fmt.Sprintf("%s%s", "/dns/managed/name?domainname=", domainName) @@ -78,7 +78,7 @@ func (c *Client) GetDomain(authZone string) (*Domain, error) { return domain, nil } -// GetRecords gets all TXT records +// GetRecords gets all TXT records. func (c *Client) GetRecords(domain *Domain, recordName, recordType string) (*[]Record, error) { resource := fmt.Sprintf("%s/%d/%s%s%s%s", "/dns/managed", domain.ID, "records?recordName=", recordName, "&type=", recordType) @@ -97,7 +97,7 @@ func (c *Client) GetRecords(domain *Domain, recordName, recordType string) (*[]R return records.Records, nil } -// CreateRecord creates a TXT records +// CreateRecord creates a TXT records. func (c *Client) CreateRecord(domain *Domain, record *Record) error { url := fmt.Sprintf("%s/%d/%s", "/dns/managed", domain.ID, "records") @@ -110,7 +110,7 @@ func (c *Client) CreateRecord(domain *Domain, record *Record) error { return nil } -// DeleteRecord deletes a TXT records +// DeleteRecord deletes a TXT records. func (c *Client) DeleteRecord(record Record) error { resource := fmt.Sprintf("%s/%d/%s/%d", "/dns/managed", record.SourceID, "records", record.ID) diff --git a/providers/dns/dnspod/dnspod.go b/providers/dns/dnspod/dnspod.go index af1078a0..21831a3d 100644 --- a/providers/dns/dnspod/dnspod.go +++ b/providers/dns/dnspod/dnspod.go @@ -26,7 +26,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { LoginToken string TTL int @@ -35,7 +35,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, 600), @@ -47,7 +47,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *dnspod.Client diff --git a/providers/dns/dode/dode.go b/providers/dns/dode/dode.go index c531c830..7029fd7c 100644 --- a/providers/dns/dode/dode.go +++ b/providers/dns/dode/dode.go @@ -23,7 +23,7 @@ const ( EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { Token string PropagationTimeout time.Duration @@ -32,7 +32,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, dns01.DefaultPropagationTimeout), @@ -44,7 +44,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider adds and removes the record for the DNS challenge +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config } @@ -82,7 +82,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return d.updateTxtRecord(fqdn, d.config.Token, txtRecord, false) } -// CleanUp clears TXT record +// CleanUp clears TXT record. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, _ := dns01.GetRecord(domain, keyAuth) return d.updateTxtRecord(fqdn, d.config.Token, "", true) diff --git a/providers/dns/dreamhost/client.go b/providers/dns/dreamhost/client.go index 63a6a7ad..7d2ae0eb 100644 --- a/providers/dns/dreamhost/client.go +++ b/providers/dns/dreamhost/client.go @@ -41,7 +41,7 @@ func (d *DNSProvider) buildQuery(action, domain, txt string) (*url.URL, error) { } // updateTxtRecord will either add or remove a TXT record. -// action is either cmdAddRecord or cmdRemoveRecord +// action is either cmdAddRecord or cmdRemoveRecord. func (d *DNSProvider) updateTxtRecord(u fmt.Stringer) error { resp, err := d.config.HTTPClient.Get(u.String()) if err != nil { diff --git a/providers/dns/dreamhost/dreamhost.go b/providers/dns/dreamhost/dreamhost.go index 822ca41e..a8b9a166 100644 --- a/providers/dns/dreamhost/dreamhost.go +++ b/providers/dns/dreamhost/dreamhost.go @@ -24,7 +24,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { BaseURL string APIKey string @@ -33,7 +33,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ BaseURL: defaultBaseURL, @@ -45,7 +45,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider adds and removes the record for the DNS challenge +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config } @@ -81,7 +81,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { return &DNSProvider{config: config}, nil } -// Present creates a TXT record to fulfill the dns-01 challenge. +// Present creates a TXT record using the specified parameters. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) record := dns01.UnFqdn(fqdn) @@ -98,7 +98,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp clears DreamHost TXT record +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) record := dns01.UnFqdn(fqdn) diff --git a/providers/dns/duckdns/client.go b/providers/dns/duckdns/client.go index 03f12b13..b8b6513d 100644 --- a/providers/dns/duckdns/client.go +++ b/providers/dns/duckdns/client.go @@ -47,10 +47,10 @@ func (d *DNSProvider) updateTxtRecord(domain, token, txt string, clear bool) err return nil } -// DuckDNS only lets you write to your subdomain -// so it must be in format subdomain.duckdns.org -// not in format subsubdomain.subdomain.duckdns.org -// so strip off everything that is not top 3 levels +// DuckDNS only lets you write to your subdomain. +// It must be in format subdomain.duckdns.org, +// not in format subsubdomain.subdomain.duckdns.org. +// So strip off everything that is not top 3 levels. func getMainDomain(domain string) string { domain = dns01.UnFqdn(domain) diff --git a/providers/dns/duckdns/duckdns.go b/providers/dns/duckdns/duckdns.go index e58fee7d..7dea6361 100644 --- a/providers/dns/duckdns/duckdns.go +++ b/providers/dns/duckdns/duckdns.go @@ -24,7 +24,7 @@ const ( EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { Token string PropagationTimeout time.Duration @@ -33,7 +33,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, dns01.DefaultPropagationTimeout), @@ -45,7 +45,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider adds and removes the record for the DNS challenge +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config } @@ -83,7 +83,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return d.updateTxtRecord(domain, d.config.Token, txtRecord, false) } -// CleanUp clears DuckDNS TXT record +// CleanUp clears DuckDNS TXT record. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { return d.updateTxtRecord(domain, d.config.Token, "", true) } diff --git a/providers/dns/dyn/client.go b/providers/dns/dyn/client.go index 1257f3ac..52faf2c2 100644 --- a/providers/dns/dyn/client.go +++ b/providers/dns/dyn/client.go @@ -60,7 +60,7 @@ func (d *DNSProvider) login() error { return nil } -// Destroys Dyn Session +// Destroys Dyn Session. func (d *DNSProvider) logout() error { if len(d.token) == 0 { // nothing to do diff --git a/providers/dns/dyn/dyn.go b/providers/dns/dyn/dyn.go index 77a3dc33..71545434 100644 --- a/providers/dns/dyn/dyn.go +++ b/providers/dns/dyn/dyn.go @@ -26,7 +26,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { CustomerName string UserName string @@ -37,7 +37,7 @@ type Config struct { TTL int } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL), @@ -49,8 +49,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface that uses -// Dyn's Managed DNS API to manage TXT records for a domain. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config token string @@ -73,7 +72,7 @@ func NewDNSProvider() (*DNSProvider, error) { return NewDNSProviderConfig(config) } -// NewDNSProviderConfig return a DNSProvider instance configured for Dyn DNS +// NewDNSProviderConfig return a DNSProvider instance configured for Dyn DNS. func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { if config == nil { return nil, errors.New("dyn: the configuration of the DNS provider is nil") @@ -86,7 +85,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { return &DNSProvider{config: config}, nil } -// Present creates a TXT record using the specified parameters +// Present creates a TXT record using the specified parameters. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -121,7 +120,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return d.logout() } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, _ := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/dynu/dynu.go b/providers/dns/dynu/dynu.go index 3158e132..062c71de 100644 --- a/providers/dns/dynu/dynu.go +++ b/providers/dns/dynu/dynu.go @@ -26,7 +26,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { APIKey string @@ -36,7 +36,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, 300), @@ -48,7 +48,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *internal.Client @@ -95,7 +95,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// Present creates a TXT record using the specified parameters +// Present creates a TXT record using the specified parameters. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -134,7 +134,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/dynu/internal/auth.go b/providers/dns/dynu/internal/auth.go index e03f39f1..527c42db 100644 --- a/providers/dns/dynu/internal/auth.go +++ b/providers/dns/dynu/internal/auth.go @@ -25,7 +25,7 @@ func NewTokenTransport(apiKey string) (*TokenTransport, error) { return &TokenTransport{apiKey: apiKey}, nil } -// RoundTrip executes a single HTTP transaction +// RoundTrip executes a single HTTP transaction. func (t *TokenTransport) RoundTrip(req *http.Request) (*http.Response, error) { enrichedReq := &http.Request{} *enrichedReq = *req @@ -49,12 +49,12 @@ func (t *TokenTransport) transport() http.RoundTripper { return http.DefaultTransport } -// Client Creates a new HTTP client +// Client Creates a new HTTP client. func (t *TokenTransport) Client() *http.Client { return &http.Client{Transport: t} } -// Wrap Wrap a HTTP client Transport with the TokenTransport +// Wrap Wrap a HTTP client Transport with the TokenTransport. func (t *TokenTransport) Wrap(client *http.Client) *http.Client { backup := client.Transport t.Transport = backup diff --git a/providers/dns/easydns/easydns.go b/providers/dns/easydns/easydns.go index ec96fa7b..9f1567cc 100644 --- a/providers/dns/easydns/easydns.go +++ b/providers/dns/easydns/easydns.go @@ -31,7 +31,7 @@ const ( EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { Endpoint *url.URL Token string @@ -43,7 +43,7 @@ type Config struct { SequenceInterval time.Duration } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL), @@ -56,7 +56,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider describes a provider for acme-proxy +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config recordIDs map[string]string @@ -101,7 +101,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { return &DNSProvider{config: config, recordIDs: map[string]string{}}, nil } -// Present creates a TXT record to fulfill the dns-01 challenge +// Present creates a TXT record to fulfill the dns-01 challenge. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -129,7 +129,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, challenge := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/exec/exec.go b/providers/dns/exec/exec.go index 93f02357..205fcbbb 100644 --- a/providers/dns/exec/exec.go +++ b/providers/dns/exec/exec.go @@ -32,7 +32,7 @@ type Config struct { PollingInterval time.Duration } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, dns01.DefaultPropagationTimeout), @@ -40,8 +40,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider adds and removes the record for the DNS challenge by calling a -// program with command-line parameters. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config } @@ -91,7 +90,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return err } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { var args []string if d.config.Mode == "RAW" { diff --git a/providers/dns/exoscale/exoscale.go b/providers/dns/exoscale/exoscale.go index 840d0f5f..cb5e30d5 100644 --- a/providers/dns/exoscale/exoscale.go +++ b/providers/dns/exoscale/exoscale.go @@ -29,7 +29,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { APIKey string APISecret string @@ -40,7 +40,7 @@ type Config struct { TTL int } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL), @@ -52,7 +52,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *egoscale.Client @@ -169,7 +169,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { } // FindExistingRecordID Query Exoscale to find an existing record for this name. -// Returns nil if no record could be found +// Returns nil if no record could be found. func (d *DNSProvider) FindExistingRecordID(zone, recordName string) (int64, error) { ctx := context.Background() records, err := d.client.GetRecords(ctx, zone) @@ -184,7 +184,7 @@ func (d *DNSProvider) FindExistingRecordID(zone, recordName string) (int64, erro return 0, nil } -// FindZoneAndRecordName Extract DNS zone and DNS entry name +// FindZoneAndRecordName Extract DNS zone and DNS entry name. func (d *DNSProvider) FindZoneAndRecordName(fqdn, domain string) (string, string, error) { zone, err := dns01.FindZoneByFqdn(dns01.ToFqdn(domain)) if err != nil { diff --git a/providers/dns/fastdns/fastdns.go b/providers/dns/fastdns/fastdns.go index 17f34053..7c97f071 100644 --- a/providers/dns/fastdns/fastdns.go +++ b/providers/dns/fastdns/fastdns.go @@ -27,7 +27,7 @@ const ( EnvPollingInterval = envNamespace + "POLLING_INTERVAL" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { edgegrid.Config PropagationTimeout time.Duration @@ -35,7 +35,7 @@ type Config struct { TTL int } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL), @@ -44,13 +44,13 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config } // NewDNSProvider uses the supplied environment variables to return a DNSProvider instance: -// AKAMAI_HOST, AKAMAI_CLIENT_TOKEN, AKAMAI_CLIENT_SECRET, AKAMAI_ACCESS_TOKEN +// AKAMAI_HOST, AKAMAI_CLIENT_TOKEN, AKAMAI_CLIENT_SECRET, AKAMAI_ACCESS_TOKEN. func NewDNSProvider() (*DNSProvider, error) { values, err := env.Get(EnvHost, EnvClientToken, EnvClientSecret, EnvAccessToken) if err != nil { @@ -82,7 +82,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { return &DNSProvider{config: config}, nil } -// Present creates a TXT record to fullfil the dns-01 challenge. +// Present creates a TXT record to fulfill the dns-01 challenge. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) zoneName, recordName, err := d.findZoneAndRecordName(fqdn, domain) diff --git a/providers/dns/gandi/gandi.go b/providers/dns/gandi/gandi.go index ae5ec10f..97ff029c 100644 --- a/providers/dns/gandi/gandi.go +++ b/providers/dns/gandi/gandi.go @@ -34,7 +34,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { BaseURL string APIKey string @@ -44,7 +44,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, minTTL), @@ -56,16 +56,14 @@ func NewDefaultConfig() *Config { } } -// inProgressInfo contains information about an in-progress challenge +// inProgressInfo contains information about an in-progress challenge. type inProgressInfo struct { zoneID int // zoneID of gandi zone to restore in CleanUp newZoneID int // zoneID of temporary gandi zone containing TXT record authZone string // the domain name registered at gandi with trailing "." } -// DNSProvider is an implementation of the -// challenge.ProviderTimeout interface that uses Gandi's XML-RPC -// API to manage TXT records for a domain. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { inProgressFQDNs map[string]inProgressInfo inProgressAuthZones map[string]struct{} diff --git a/providers/dns/gandi/gandi_mock_test.go b/providers/dns/gandi/gandi_mock_test.go index 66c63fa3..970588ef 100644 --- a/providers/dns/gandi/gandi_mock_test.go +++ b/providers/dns/gandi/gandi_mock_test.go @@ -1,7 +1,7 @@ package gandi -// CleanUp Request->Response 1 (setZone) -const cleanup1RequestMock = ` +// CleanUp Request->Response 1 (setZone). +const cleanupSetZoneRequestMock = ` domain.zone.set @@ -21,8 +21,8 @@ const cleanup1RequestMock = ` ` -// CleanUp Request->Response 1 (setZone) -const cleanup1ResponseMock = ` +// CleanUp Request->Response 1 (setZone). +const cleanupSetZoneResponseMock = ` @@ -191,8 +191,8 @@ const cleanup1ResponseMock = ` ` -// CleanUp Request->Response 2 (deleteZone) -const cleanup2RequestMock = ` +// CleanUp Request->Response 2 (deleteZone). +const cleanupDeleteZoneRequestMock = ` domain.zone.delete @@ -207,8 +207,8 @@ const cleanup2RequestMock = ` ` -// CleanUp Request->Response 2 (deleteZone) -const cleanup2ResponseMock = ` +// CleanUp Request->Response 2 (deleteZone). +const cleanupDeleteZoneResponseMock = ` @@ -218,8 +218,8 @@ const cleanup2ResponseMock = ` ` -// Present Request->Response 1 (getZoneID) -const present1RequestMock = ` +// Present Request->Response 1 (getZoneID). +const presentGetZoneIDRequestMock = ` domain.info @@ -234,8 +234,8 @@ const present1RequestMock = ` ` -// Present Request->Response 1 (getZoneID) -const present1ResponseMock = ` +// Present Request->Response 1 (getZoneID). +const presentGetZoneIDResponseMock = ` @@ -404,8 +404,8 @@ const present1ResponseMock = ` ` -// Present Request->Response 2 (cloneZone) -const present2RequestMock = ` +// Present Request->Response 2 (cloneZone). +const presentCloneZoneRequestMock = ` domain.zone.clone @@ -437,8 +437,8 @@ const present2RequestMock = ` ` -// Present Request->Response 2 (cloneZone) -const present2ResponseMock = ` +// Present Request->Response 2 (cloneZone). +const presentCloneZoneResponseMock = ` @@ -483,8 +483,8 @@ const present2ResponseMock = ` ` -// Present Request->Response 3 (newZoneVersion) -const present3RequestMock = ` +// Present Request->Response 3 (newZoneVersion). +const presentNewZoneVersionRequestMock = ` domain.zone.version.new @@ -499,8 +499,8 @@ const present3RequestMock = ` ` -// Present Request->Response 3 (newZoneVersion) -const present3ResponseMock = ` +// Present Request->Response 3 (newZoneVersion). +const presentNewZoneVersionResponseMock = ` @@ -510,8 +510,8 @@ const present3ResponseMock = ` ` -// Present Request->Response 4 (addTXTRecord) -const present4RequestMock = ` +// Present Request->Response 4 (addTXTRecord). +const presentAddTXTRecordRequestMock = ` domain.zone.record.add @@ -561,8 +561,8 @@ const present4RequestMock = ` ` -// Present Request->Response 4 (addTXTRecord) -const present4ResponseMock = ` +// Present Request->Response 4 (addTXTRecord). +const presentAddTXTRecordResponseMock = ` @@ -593,8 +593,8 @@ const present4ResponseMock = ` ` -// Present Request->Response 5 (setZoneVersion) -const present5RequestMock = ` +// Present Request->Response 5 (setZoneVersion). +const presentSetZoneVersionRequestMock = ` domain.zone.version.set @@ -614,8 +614,8 @@ const present5RequestMock = ` ` -// Present Request->Response 5 (setZoneVersion) -const present5ResponseMock = ` +// Present Request->Response 5 (setZoneVersion). +const presentSetZoneVersionResponseMock = ` @@ -625,8 +625,8 @@ const present5ResponseMock = ` ` -// Present Request->Response 6 (setZone) -const present6RequestMock = ` +// Present Request->Response 6 (setZone). +const presentSetZoneRequestMock = ` domain.zone.set @@ -646,8 +646,8 @@ const present6RequestMock = ` ` -// Present Request->Response 6 (setZone) -const present6ResponseMock = ` +// Present Request->Response 6 (setZone). +const presentSetZoneResponseMock = ` diff --git a/providers/dns/gandi/gandi_test.go b/providers/dns/gandi/gandi_test.go index 60985286..bee51a4c 100644 --- a/providers/dns/gandi/gandi_test.go +++ b/providers/dns/gandi/gandi_test.go @@ -103,21 +103,21 @@ func TestDNSProvider(t *testing.T) { // anonymizing the RPC data. var serverResponses = map[string]string{ // Present Request->Response 1 (getZoneID) - present1RequestMock: present1ResponseMock, + presentGetZoneIDRequestMock: presentGetZoneIDResponseMock, // Present Request->Response 2 (cloneZone) - present2RequestMock: present2ResponseMock, + presentCloneZoneRequestMock: presentCloneZoneResponseMock, // Present Request->Response 3 (newZoneVersion) - present3RequestMock: present3ResponseMock, + presentNewZoneVersionRequestMock: presentNewZoneVersionResponseMock, // Present Request->Response 4 (addTXTRecord) - present4RequestMock: present4ResponseMock, + presentAddTXTRecordRequestMock: presentAddTXTRecordResponseMock, // Present Request->Response 5 (setZoneVersion) - present5RequestMock: present5ResponseMock, + presentSetZoneVersionRequestMock: presentSetZoneVersionResponseMock, // Present Request->Response 6 (setZone) - present6RequestMock: present6ResponseMock, + presentSetZoneRequestMock: presentSetZoneResponseMock, // CleanUp Request->Response 1 (setZone) - cleanup1RequestMock: cleanup1ResponseMock, + cleanupSetZoneRequestMock: cleanupSetZoneResponseMock, // CleanUp Request->Response 2 (deleteZone) - cleanup2RequestMock: cleanup2ResponseMock, + cleanupDeleteZoneRequestMock: cleanupDeleteZoneResponseMock, } fakeKeyAuth := "XXXX" diff --git a/providers/dns/gandiv5/client.go b/providers/dns/gandiv5/client.go index c83a5436..7671531c 100644 --- a/providers/dns/gandiv5/client.go +++ b/providers/dns/gandiv5/client.go @@ -13,13 +13,13 @@ import ( const apiKeyHeader = "X-Api-Key" -// types for JSON responses with only a message +// types for JSON responses with only a message. type apiResponse struct { Message string `json:"message"` UUID string `json:"uuid,omitempty"` } -// Record TXT record representation +// Record TXT record representation. type Record struct { RRSetTTL int `json:"rrset_ttl"` RRSetValues []string `json:"rrset_values"` diff --git a/providers/dns/gandiv5/gandiv5.go b/providers/dns/gandiv5/gandiv5.go index 0ad79e7f..accf434d 100644 --- a/providers/dns/gandiv5/gandiv5.go +++ b/providers/dns/gandiv5/gandiv5.go @@ -33,13 +33,13 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// inProgressInfo contains information about an in-progress challenge +// inProgressInfo contains information about an in-progress challenge. type inProgressInfo struct { fieldName string authZone string } -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { BaseURL string APIKey string @@ -49,7 +49,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, minTTL), @@ -61,9 +61,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the -// challenge.ProviderTimeout interface that uses Gandi's LiveDNS -// API to manage TXT records for a domain. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config inProgressFQDNs map[string]inProgressInfo @@ -171,9 +169,8 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { return nil } -// Timeout returns the values (20*time.Minute, 20*time.Second) which -// are used by the acme package as timeout and check interval values -// when checking for DNS record propagation with Gandi. +// Timeout returns the timeout and interval to use when checking for DNS propagation. +// Adjusting here to cope with spikes in propagation times. func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } diff --git a/providers/dns/gcloud/googlecloud.go b/providers/dns/gcloud/googlecloud.go index 7a39d03f..cdc64eaa 100644 --- a/providers/dns/gcloud/googlecloud.go +++ b/providers/dns/gcloud/googlecloud.go @@ -39,7 +39,7 @@ const ( EnvPollingInterval = envNamespace + "POLLING_INTERVAL" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { Debug bool Project string @@ -49,7 +49,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ Debug: env.GetOrDefaultBool(EnvDebug, false), @@ -59,7 +59,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the DNSProvider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *dns.Service @@ -69,7 +69,7 @@ type DNSProvider struct { // By default, the project name is auto-detected by using the metadata service, // it can be overridden using the GCE_PROJECT environment variable. // A Service Account can be passed in the environment variable: GCE_SERVICE_ACCOUNT -// or by specifying the keyfile location: GCE_SERVICE_ACCOUNT_FILE +// or by specifying the keyfile location: GCE_SERVICE_ACCOUNT_FILE. func NewDNSProvider() (*DNSProvider, error) { // Use a service account file if specified via environment variable. if saKey := env.GetOrFile(EnvServiceAccount); len(saKey) > 0 { @@ -306,7 +306,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// getHostedZone returns the managed-zone +// getHostedZone returns the managed-zone. func (d *DNSProvider) getHostedZone(domain string) (string, error) { authZone, err := dns01.FindZoneByFqdn(dns01.ToFqdn(domain)) if err != nil { diff --git a/providers/dns/glesys/glesys.go b/providers/dns/glesys/glesys.go index b3da1783..b10ff041 100644 --- a/providers/dns/glesys/glesys.go +++ b/providers/dns/glesys/glesys.go @@ -32,7 +32,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { APIUser string APIKey string @@ -42,7 +42,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, minTTL), @@ -54,9 +54,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the -// challenge.ProviderTimeout interface that uses GleSYS -// API to manage TXT records for a domain. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config activeRecords map[string]int diff --git a/providers/dns/godaddy/client.go b/providers/dns/godaddy/client.go index 46566a88..50cdc54e 100644 --- a/providers/dns/godaddy/client.go +++ b/providers/dns/godaddy/client.go @@ -10,7 +10,7 @@ import ( "path" ) -// DNSRecord a DNS record +// DNSRecord a DNS record. type DNSRecord struct { Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` diff --git a/providers/dns/godaddy/godaddy.go b/providers/dns/godaddy/godaddy.go index a625067c..cade7aae 100644 --- a/providers/dns/godaddy/godaddy.go +++ b/providers/dns/godaddy/godaddy.go @@ -31,7 +31,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { APIKey string APISecret string @@ -41,7 +41,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, minTTL), @@ -53,7 +53,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config } @@ -97,7 +97,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// Present creates a TXT record to fulfill the dns-01 challenge +// Present creates a TXT record to fulfill the dns-01 challenge. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -136,7 +136,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp sets null value in the TXT DNS record as GoDaddy has no proper DELETE record method +// CleanUp removes the record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/godaddy/godaddy.toml b/providers/dns/godaddy/godaddy.toml index eb4acb6e..3e6f3ab4 100644 --- a/providers/dns/godaddy/godaddy.toml +++ b/providers/dns/godaddy/godaddy.toml @@ -4,6 +4,12 @@ URL = "https://godaddy.com" Code = "godaddy" Since = "v0.5.0" +Example = ''' +GODADDY_API_KEY=xxxxxxxx \ +GODADDY_API_SECRET=yyyyyyyy \ +lego --dns godaddy --domains my.domain.com --email my@email.com run +''' + [Configuration] [Configuration.Credentials] GODADDY_API_KEY = "API key" diff --git a/providers/dns/hetzner/hetzner.go b/providers/dns/hetzner/hetzner.go index 1178f382..fedddce6 100644 --- a/providers/dns/hetzner/hetzner.go +++ b/providers/dns/hetzner/hetzner.go @@ -48,7 +48,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *internal.Client diff --git a/providers/dns/hostingde/hostingde.go b/providers/dns/hostingde/hostingde.go index bfee68d7..3e334a80 100644 --- a/providers/dns/hostingde/hostingde.go +++ b/providers/dns/hostingde/hostingde.go @@ -25,7 +25,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { APIKey string ZoneName string @@ -35,7 +35,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL), @@ -47,7 +47,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config recordIDs map[string]string @@ -56,7 +56,7 @@ type DNSProvider struct { // NewDNSProvider returns a DNSProvider instance configured for hosting.de. // Credentials must be passed in the environment variables: -// HOSTINGDE_ZONE_NAME and HOSTINGDE_API_KEY +// HOSTINGDE_ZONE_NAME and HOSTINGDE_API_KEY. func NewDNSProvider() (*DNSProvider, error) { values, err := env.Get(EnvAPIKey, EnvZoneName) if err != nil { @@ -96,7 +96,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// Present creates a TXT record to fulfill the dns-01 challenge +// Present creates a TXT record to fulfill the dns-01 challenge. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -150,7 +150,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/httpreq/httpreq.go b/providers/dns/httpreq/httpreq.go index cec00984..2e91f756 100644 --- a/providers/dns/httpreq/httpreq.go +++ b/providers/dns/httpreq/httpreq.go @@ -41,7 +41,7 @@ type messageRaw struct { KeyAuth string `json:"keyAuth"` } -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { Endpoint *url.URL Mode string @@ -52,7 +52,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, dns01.DefaultPropagationTimeout), @@ -63,7 +63,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider describes a provider for acme-proxy +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config } @@ -107,7 +107,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// Present creates a TXT record to fulfill the dns-01 challenge +// Present creates a TXT record to fulfill the dns-01 challenge. func (d *DNSProvider) Present(domain, token, keyAuth string) error { if d.config.Mode == "RAW" { msg := &messageRaw{ @@ -136,7 +136,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { if d.config.Mode == "RAW" { msg := &messageRaw{ diff --git a/providers/dns/iij/iij.go b/providers/dns/iij/iij.go index 8d8ff18f..2a915264 100644 --- a/providers/dns/iij/iij.go +++ b/providers/dns/iij/iij.go @@ -27,7 +27,7 @@ const ( EnvPollingInterval = envNamespace + "POLLING_INTERVAL" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { AccessKey string SecretKey string @@ -37,7 +37,7 @@ type Config struct { TTL int } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, 300), @@ -46,13 +46,13 @@ func NewDefaultConfig() *Config { } } -// DNSProvider implements the challenge.Provider interface +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { api *doapi.API config *Config } -// NewDNSProvider returns a DNSProvider instance configured for IIJ DO +// NewDNSProvider returns a DNSProvider instance configured for IIJ DNS. func NewDNSProvider() (*DNSProvider, error) { values, err := env.Get(EnvAPIAccessKey, EnvAPISecretKey, EnvDoServiceCode) if err != nil { @@ -68,7 +68,7 @@ func NewDNSProvider() (*DNSProvider, error) { } // NewDNSProviderConfig takes a given config -// and returns a custom configured DNSProvider instance +// and returns a custom configured DNSProvider instance. func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { if config.SecretKey == "" || config.AccessKey == "" || config.DoServiceCode == "" { return nil, errors.New("iij: credentials missing") @@ -85,7 +85,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// Present creates a TXT record using the specified parameters +// Present creates a TXT record using the specified parameters. func (d *DNSProvider) Present(domain, token, keyAuth string) error { _, value := dns01.GetRecord(domain, keyAuth) @@ -96,7 +96,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { _, value := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/internal/selectel/models.go b/providers/dns/internal/selectel/models.go index 0332d00e..df7bb3fa 100644 --- a/providers/dns/internal/selectel/models.go +++ b/providers/dns/internal/selectel/models.go @@ -18,7 +18,7 @@ type Record struct { Content string `json:"content,omitempty"` // Record content (not for SRV) } -// APIError API error message +// APIError API error message. type APIError struct { Description string `json:"error"` Code int `json:"code"` diff --git a/providers/dns/inwx/inwx.go b/providers/dns/inwx/inwx.go index 01a3d6b5..20f08ee9 100644 --- a/providers/dns/inwx/inwx.go +++ b/providers/dns/inwx/inwx.go @@ -25,7 +25,7 @@ const ( EnvPollingInterval = envNamespace + "POLLING_INTERVAL" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { Username string Password string @@ -35,7 +35,7 @@ type Config struct { TTL int } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, 300), @@ -45,7 +45,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *goinwx.Client @@ -67,7 +67,7 @@ func NewDNSProvider() (*DNSProvider, error) { return NewDNSProviderConfig(config) } -// NewDNSProviderConfig return a DNSProvider instance configured for Dyn DNS +// NewDNSProviderConfig return a DNSProvider instance configured for Dyn DNS. func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { if config == nil { return nil, errors.New("inwx: the configuration of the DNS provider is nil") @@ -86,7 +86,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { return &DNSProvider{config: config, client: client}, nil } -// Present creates a TXT record using the specified parameters +// Present creates a TXT record using the specified parameters. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -131,7 +131,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, _ := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/joker/client.go b/providers/dns/joker/client.go index 3eb5d431..30eca0ec 100644 --- a/providers/dns/joker/client.go +++ b/providers/dns/joker/client.go @@ -15,7 +15,7 @@ import ( const defaultBaseURL = "https://dmapi.joker.com/request/" -// Joker DMAPI Response +// Joker DMAPI Response. type response struct { Headers url.Values Body string @@ -24,7 +24,7 @@ type response struct { AuthSid string } -// parseResponse parses HTTP response body +// parseResponse parses HTTP response body. func parseResponse(message string) *response { r := &response{Headers: url.Values{}, StatusCode: -1} @@ -64,7 +64,7 @@ func parseResponse(message string) *response { return r } -// login performs a login to Joker's DMAPI +// login performs a login to Joker's DMAPI. func (d *DNSProvider) login() (*response, error) { if d.config.AuthSid != "" { // already logged in @@ -102,7 +102,7 @@ func (d *DNSProvider) login() (*response, error) { return response, nil } -// logout closes authenticated session with Joker's DMAPI +// logout closes authenticated session with Joker's DMAPI. func (d *DNSProvider) logout() (*response, error) { if d.config.AuthSid == "" { return nil, errors.New("already logged out") @@ -115,7 +115,7 @@ func (d *DNSProvider) logout() (*response, error) { return response, err } -// getZone returns content of DNS zone for domain +// getZone returns content of DNS zone for domain. func (d *DNSProvider) getZone(domain string) (*response, error) { if d.config.AuthSid == "" { return nil, errors.New("must be logged in to get zone") @@ -124,7 +124,7 @@ func (d *DNSProvider) getZone(domain string) (*response, error) { return d.postRequest("dns-zone-get", url.Values{"domain": {dns01.UnFqdn(domain)}}) } -// putZone uploads DNS zone to Joker DMAPI +// putZone uploads DNS zone to Joker DMAPI. func (d *DNSProvider) putZone(domain, zone string) (*response, error) { if d.config.AuthSid == "" { return nil, errors.New("must be logged in to put zone") @@ -133,7 +133,7 @@ func (d *DNSProvider) putZone(domain, zone string) (*response, error) { return d.postRequest("dns-zone-put", url.Values{"domain": {dns01.UnFqdn(domain)}, "zone": {strings.TrimSpace(zone)}}) } -// postRequest performs actual HTTP request +// postRequest performs actual HTTP request. func (d *DNSProvider) postRequest(cmd string, data url.Values) (*response, error) { uri := d.config.BaseURL + cmd @@ -163,7 +163,7 @@ func (d *DNSProvider) postRequest(cmd string, data url.Values) (*response, error return parseResponse(string(body)), nil } -// Temporary workaround, until it get fixed on API side +// Temporary workaround, until it get fixed on API side. func fixTxtLines(line string) string { fields := strings.Fields(line) @@ -179,7 +179,7 @@ func fixTxtLines(line string) string { return strings.Join(fields, " ") } -// removeTxtEntryFromZone clean-ups all TXT records with given name +// removeTxtEntryFromZone clean-ups all TXT records with given name. func removeTxtEntryFromZone(zone, relative string) (string, bool) { prefix := fmt.Sprintf("%s TXT 0 ", relative) @@ -196,7 +196,7 @@ func removeTxtEntryFromZone(zone, relative string) (string, bool) { return strings.TrimSpace(strings.Join(zoneEntries, "\n")), modified } -// addTxtEntryToZone returns DNS zone with added TXT record +// addTxtEntryToZone returns DNS zone with added TXT record. func addTxtEntryToZone(zone, relative, value string, ttl int) string { var zoneEntries []string diff --git a/providers/dns/joker/joker.go b/providers/dns/joker/joker.go index cef5d399..8cd5bb1e 100644 --- a/providers/dns/joker/joker.go +++ b/providers/dns/joker/joker.go @@ -42,7 +42,7 @@ type Config struct { AuthSid string } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ BaseURL: defaultBaseURL, @@ -56,8 +56,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the ChallengeProviderTimeout interface -// that uses Joker's DMAPI to manage TXT records for a domain. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config } @@ -190,7 +189,7 @@ func getRelative(fqdn, zone string) string { return dns01.UnFqdn(strings.TrimSuffix(fqdn, dns01.ToFqdn(zone))) } -// formatResponseError formats error with optional details from DMAPI response +// formatResponseError formats error with optional details from DMAPI response. func formatResponseError(response *response, err error) error { if response != nil { return fmt.Errorf("joker: DMAPI error: %w Response: %v", err, response.Headers) diff --git a/providers/dns/lightsail/lightsail.go b/providers/dns/lightsail/lightsail.go index 0397c951..f3c8874a 100644 --- a/providers/dns/lightsail/lightsail.go +++ b/providers/dns/lightsail/lightsail.go @@ -52,7 +52,7 @@ func (c customRetryer) RetryRules(r *request.Request) time.Duration { return time.Duration(delay) * time.Millisecond } -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { DNSZone string Region string @@ -60,7 +60,7 @@ type Config struct { PollingInterval time.Duration } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ DNSZone: env.GetOrFile(EnvDNSZone), @@ -70,7 +70,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider implements the challenge.Provider interface +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { client *lightsail.Lightsail config *Config @@ -113,7 +113,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { }, nil } -// Present creates a TXT record using the specified parameters +// Present creates a TXT record using the specified parameters. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -124,7 +124,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/lightsail/mock_server_test.go b/providers/dns/lightsail/mock_server_test.go index a90d2f71..da1b12f3 100644 --- a/providers/dns/lightsail/mock_server_test.go +++ b/providers/dns/lightsail/mock_server_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/require" ) -// MockResponse represents a predefined response used by a mock server +// MockResponse represents a predefined response used by a mock server. type MockResponse struct { StatusCode int Body string diff --git a/providers/dns/linode/linode.go b/providers/dns/linode/linode.go index f6d7d8d8..331a759b 100644 --- a/providers/dns/linode/linode.go +++ b/providers/dns/linode/linode.go @@ -28,14 +28,14 @@ const ( EnvPollingInterval = envNamespace + "POLLING_INTERVAL" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { APIKey string PollingInterval time.Duration TTL int } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, minTTL), diff --git a/providers/dns/linodev4/linodev4.go b/providers/dns/linodev4/linodev4.go index 01b08eb9..b2d8ff1f 100644 --- a/providers/dns/linodev4/linodev4.go +++ b/providers/dns/linodev4/linodev4.go @@ -34,7 +34,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { Token string PropagationTimeout time.Duration @@ -43,7 +43,7 @@ type Config struct { HTTPTimeout time.Duration } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, minTTL), diff --git a/providers/dns/liquidweb/liquidweb.go b/providers/dns/liquidweb/liquidweb.go index e3ed9635..e014e5fe 100644 --- a/providers/dns/liquidweb/liquidweb.go +++ b/providers/dns/liquidweb/liquidweb.go @@ -31,7 +31,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { BaseURL string Username string @@ -43,7 +43,7 @@ type Config struct { HTTPTimeout time.Duration } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { config := &Config{ BaseURL: defaultBaseURL, @@ -56,8 +56,7 @@ func NewDefaultConfig() *Config { return config } -// DNSProvider is an implementation of the challenge.Provider interface -// that uses Liquid Web's REST API to manage TXT records for a domain. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *lw.API @@ -122,7 +121,7 @@ func (d *DNSProvider) Timeout() (time.Duration, time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// Present creates a TXT record using the specified parameters +// Present creates a TXT record using the specified parameters. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -146,7 +145,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { d.recordIDsMu.Lock() recordID, ok := d.recordIDs[token] diff --git a/providers/dns/mydnsjp/mydnsjp.go b/providers/dns/mydnsjp/mydnsjp.go index fd3d449e..a7c32675 100644 --- a/providers/dns/mydnsjp/mydnsjp.go +++ b/providers/dns/mydnsjp/mydnsjp.go @@ -25,7 +25,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { MasterID string Password string @@ -34,7 +34,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, 2*time.Minute), @@ -45,7 +45,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config } @@ -84,7 +84,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// Present creates a TXT record to fulfill the dns-01 challenge +// Present creates a TXT record to fulfill the dns-01 challenge. func (d *DNSProvider) Present(domain, token, keyAuth string) error { _, value := dns01.GetRecord(domain, keyAuth) err := d.doRequest(domain, value, "REGIST") @@ -94,7 +94,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { _, value := dns01.GetRecord(domain, keyAuth) err := d.doRequest(domain, value, "DELETE") diff --git a/providers/dns/mythicbeasts/mythicbeasts.go b/providers/dns/mythicbeasts/mythicbeasts.go index 2de817ca..95a5e801 100644 --- a/providers/dns/mythicbeasts/mythicbeasts.go +++ b/providers/dns/mythicbeasts/mythicbeasts.go @@ -27,7 +27,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { UserName string Password string @@ -39,7 +39,7 @@ type Config struct { TTL int } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() (*Config, error) { apiEndpoint, err := url.Parse(env.GetOrDefaultString(EnvAPIEndpoint, apiBaseURL)) if err != nil { @@ -63,8 +63,7 @@ func NewDefaultConfig() (*Config, error) { }, nil } -// DNSProvider is an implementation of the challenge.Provider interface that uses -// Mythic Beasts' DNSv2 API to manage TXT records for a domain. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config token string @@ -89,7 +88,7 @@ func NewDNSProvider() (*DNSProvider, error) { return NewDNSProviderConfig(config) } -// NewDNSProviderConfig return a DNSProvider instance configured for mythicbeasts DNSv2 API +// NewDNSProviderConfig return a DNSProvider instance configured for mythicbeasts DNSv2 API. func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { if config == nil { return nil, errors.New("mythicbeasts: the configuration of the DNS provider is nil") @@ -102,7 +101,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { return &DNSProvider{config: config}, nil } -// Present creates a TXT record using the specified parameters +// Present creates a TXT record using the specified parameters. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -128,7 +127,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/namecheap/namecheap.go b/providers/dns/namecheap/namecheap.go index 91bcd2cd..6b529eb4 100644 --- a/providers/dns/namecheap/namecheap.go +++ b/providers/dns/namecheap/namecheap.go @@ -51,8 +51,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// A challenge represents all the data needed to specify a dns-01 challenge -// to lets-encrypt. +// A challenge represents all the data needed to specify a dns-01 challenge to lets-encrypt. type challenge struct { domain string key string @@ -63,7 +62,7 @@ type challenge struct { host string } -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { Debug bool BaseURL string @@ -76,7 +75,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { baseURL := defaultBaseURL if env.GetOrDefaultBool(EnvSandbox, false) { @@ -95,8 +94,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the ChallengeProviderTimeout interface -// that uses Namecheap's tool API to manage TXT records for a domain. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config } diff --git a/providers/dns/namedotcom/namedotcom.go b/providers/dns/namedotcom/namedotcom.go index 58b119d2..11b54d5e 100644 --- a/providers/dns/namedotcom/namedotcom.go +++ b/providers/dns/namedotcom/namedotcom.go @@ -30,7 +30,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { Username string APIToken string @@ -41,7 +41,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, minTTL), @@ -53,7 +53,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { client *namecom.NameCom config *Config @@ -61,7 +61,7 @@ type DNSProvider struct { // NewDNSProvider returns a DNSProvider instance configured for namedotcom. // Credentials must be passed in the environment variables: -// NAMECOM_USERNAME and NAMECOM_API_TOKEN +// NAMECOM_USERNAME and NAMECOM_API_TOKEN. func NewDNSProvider() (*DNSProvider, error) { values, err := env.Get(EnvUsername, EnvAPIToken) if err != nil { diff --git a/providers/dns/namesilo/namesilo.go b/providers/dns/namesilo/namesilo.go index 315b4795..163eb517 100644 --- a/providers/dns/namesilo/namesilo.go +++ b/providers/dns/namesilo/namesilo.go @@ -28,7 +28,7 @@ const ( EnvPollingInterval = envNamespace + "POLLING_INTERVAL" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { APIKey string PropagationTimeout time.Duration @@ -36,7 +36,7 @@ type Config struct { TTL int } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, defaultTTL), @@ -45,7 +45,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { client *namesilo.Client config *Config diff --git a/providers/dns/netcup/internal/client.go b/providers/dns/netcup/internal/client.go index ab5d3379..f82ee016 100644 --- a/providers/dns/netcup/internal/client.go +++ b/providers/dns/netcup/internal/client.go @@ -10,21 +10,21 @@ import ( "time" ) -// defaultBaseURL for reaching the jSON-based API-Endpoint of netcup +// defaultBaseURL for reaching the jSON-based API-Endpoint of netcup. const defaultBaseURL = "https://ccp.netcup.net/run/webservice/servers/endpoint.php?JSON" -// success response status +// success response status. const success = "success" // Request wrapper as specified in netcup wiki -// needed for every request to netcup API around *Msg +// needed for every request to netcup API around *Msg. // https://www.netcup-wiki.de/wiki/CCP_API#Anmerkungen_zu_JSON-Requests type Request struct { Action string `json:"action"` Param interface{} `json:"param"` } -// LoginRequest as specified in netcup WSDL +// LoginRequest as specified in netcup WSDL. // https://ccp.netcup.net/run/webservice/servers/endpoint.php#login type LoginRequest struct { CustomerNumber string `json:"customernumber"` @@ -33,7 +33,7 @@ type LoginRequest struct { ClientRequestID string `json:"clientrequestid,omitempty"` } -// LogoutRequest as specified in netcup WSDL +// LogoutRequest as specified in netcup WSDL. // https://ccp.netcup.net/run/webservice/servers/endpoint.php#logout type LogoutRequest struct { CustomerNumber string `json:"customernumber"` @@ -42,7 +42,7 @@ type LogoutRequest struct { ClientRequestID string `json:"clientrequestid,omitempty"` } -// UpdateDNSRecordsRequest as specified in netcup WSDL +// UpdateDNSRecordsRequest as specified in netcup WSDL. // https://ccp.netcup.net/run/webservice/servers/endpoint.php#updateDnsRecords type UpdateDNSRecordsRequest struct { DomainName string `json:"domainname"` @@ -53,14 +53,14 @@ type UpdateDNSRecordsRequest struct { DNSRecordSet DNSRecordSet `json:"dnsrecordset"` } -// DNSRecordSet as specified in netcup WSDL +// DNSRecordSet as specified in netcup WSDL. // needed in UpdateDNSRecordsRequest // https://ccp.netcup.net/run/webservice/servers/endpoint.php#Dnsrecordset type DNSRecordSet struct { DNSRecords []DNSRecord `json:"dnsrecords"` } -// InfoDNSRecordsRequest as specified in netcup WSDL +// InfoDNSRecordsRequest as specified in netcup WSDL. // https://ccp.netcup.net/run/webservice/servers/endpoint.php#infoDnsRecords type InfoDNSRecordsRequest struct { DomainName string `json:"domainname"` @@ -70,7 +70,7 @@ type InfoDNSRecordsRequest struct { ClientRequestID string `json:"clientrequestid,omitempty"` } -// DNSRecord as specified in netcup WSDL +// DNSRecord as specified in netcup WSDL. // https://ccp.netcup.net/run/webservice/servers/endpoint.php#Dnsrecord type DNSRecord struct { ID int `json:"id,string,omitempty"` @@ -83,7 +83,7 @@ type DNSRecord struct { TTL int `json:"ttl,omitempty"` } -// ResponseMsg as specified in netcup WSDL +// ResponseMsg as specified in netcup WSDL. // https://ccp.netcup.net/run/webservice/servers/endpoint.php#Responsemessage type ResponseMsg struct { ServerRequestID string `json:"serverrequestid"` @@ -112,7 +112,7 @@ type InfoDNSRecordsResponse struct { DNSRecords []DNSRecord `json:"dnsrecords,omitempty"` } -// Client netcup DNS client +// Client netcup DNS client. type Client struct { customerNumber string apiKey string @@ -121,7 +121,7 @@ type Client struct { BaseURL string } -// NewClient creates a netcup DNS client +// NewClient creates a netcup DNS client. func NewClient(customerNumber string, apiKey string, apiPassword string) (*Client, error) { if customerNumber == "" || apiKey == "" || apiPassword == "" { return nil, errors.New("credentials missing") @@ -139,7 +139,7 @@ func NewClient(customerNumber string, apiKey string, apiPassword string) (*Clien } // Login performs the login as specified by the netcup WSDL -// returns sessionID needed to perform remaining actions +// returns sessionID needed to perform remaining actions. // https://ccp.netcup.net/run/webservice/servers/endpoint.php func (c *Client) Login() (string, error) { payload := &Request{ @@ -161,7 +161,7 @@ func (c *Client) Login() (string, error) { return responseData.APISessionID, nil } -// Logout performs the logout with the supplied sessionID as specified by the netcup WSDL +// Logout performs the logout with the supplied sessionID as specified by the netcup WSDL. // https://ccp.netcup.net/run/webservice/servers/endpoint.php func (c *Client) Logout(sessionID string) error { payload := &Request{ @@ -182,7 +182,7 @@ func (c *Client) Logout(sessionID string) error { return nil } -// UpdateDNSRecord performs an update of the DNSRecords as specified by the netcup WSDL +// UpdateDNSRecord performs an update of the DNSRecords as specified by the netcup WSDL. // https://ccp.netcup.net/run/webservice/servers/endpoint.php func (c *Client) UpdateDNSRecord(sessionID, domainName string, records []DNSRecord) error { payload := &Request{ @@ -206,7 +206,7 @@ func (c *Client) UpdateDNSRecord(sessionID, domainName string, records []DNSReco } // GetDNSRecords retrieves all dns records of an DNS-Zone as specified by the netcup WSDL -// returns an array of DNSRecords +// returns an array of DNSRecords. // https://ccp.netcup.net/run/webservice/servers/endpoint.php func (c *Client) GetDNSRecords(hostname, apiSessionID string) ([]DNSRecord, error) { payload := &Request{ @@ -230,7 +230,7 @@ func (c *Client) GetDNSRecords(hostname, apiSessionID string) ([]DNSRecord, erro } // doRequest marshals given body to JSON, send the request to netcup API -// and returns body of response +// and returns body of response. func (c *Client) doRequest(payload interface{}, responseData interface{}) error { body, err := json.Marshal(payload) if err != nil { @@ -316,7 +316,7 @@ func decodeResponseMsg(resp *http.Response) (*ResponseMsg, error) { // GetDNSRecordIdx searches a given array of DNSRecords for a given DNSRecord // equivalence is determined by Destination and RecortType attributes -// returns index of given DNSRecord in given array of DNSRecords +// returns index of given DNSRecord in given array of DNSRecords. func GetDNSRecordIdx(records []DNSRecord, record DNSRecord) (int, error) { for index, element := range records { if record.Destination == element.Destination && record.RecordType == element.RecordType { diff --git a/providers/dns/netcup/netcup.go b/providers/dns/netcup/netcup.go index a5fc4802..f17a2010 100644 --- a/providers/dns/netcup/netcup.go +++ b/providers/dns/netcup/netcup.go @@ -29,7 +29,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { Key string Password string @@ -40,7 +40,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL), @@ -52,7 +52,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { client *internal.Client config *Config @@ -60,7 +60,7 @@ type DNSProvider struct { // NewDNSProvider returns a DNSProvider instance configured for netcup. // Credentials must be passed in the environment variables: -// NETCUP_CUSTOMER_NUMBER, NETCUP_API_KEY, NETCUP_API_PASSWORD +// NETCUP_CUSTOMER_NUMBER, NETCUP_API_KEY, NETCUP_API_PASSWORD. func NewDNSProvider() (*DNSProvider, error) { values, err := env.Get(EnvCustomerNumber, EnvAPIKey, EnvAPIPassword) if err != nil { @@ -91,7 +91,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { return &DNSProvider{client: client, config: config}, nil } -// Present creates a TXT record to fulfill the dns-01 challenge +// Present creates a TXT record to fulfill the dns-01 challenge. func (d *DNSProvider) Present(domainName, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domainName, keyAuth) @@ -138,7 +138,7 @@ func (d *DNSProvider) Present(domainName, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domainName, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domainName, keyAuth) diff --git a/providers/dns/netlify/netlify.go b/providers/dns/netlify/netlify.go index b9a4b448..a8486b25 100644 --- a/providers/dns/netlify/netlify.go +++ b/providers/dns/netlify/netlify.go @@ -47,7 +47,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *internal.Client diff --git a/providers/dns/nifcloud/internal/client.go b/providers/dns/nifcloud/internal/client.go index 7d546ab7..9aac1762 100644 --- a/providers/dns/nifcloud/internal/client.go +++ b/providers/dns/nifcloud/internal/client.go @@ -87,7 +87,7 @@ type ChangeInfo struct { SubmittedAt string `xml:"SubmittedAt"` } -// NewClient Creates a new client of NIFCLOUD DNS +// NewClient Creates a new client of NIFCLOUD DNS. func NewClient(accessKey string, secretKey string) (*Client, error) { if len(accessKey) == 0 || len(secretKey) == 0 { return nil, errors.New("credentials missing") @@ -101,7 +101,7 @@ func NewClient(accessKey string, secretKey string) (*Client, error) { }, nil } -// Client client of NIFCLOUD DNS +// Client client of NIFCLOUD DNS. type Client struct { accessKey string secretKey string diff --git a/providers/dns/nifcloud/nifcloud.go b/providers/dns/nifcloud/nifcloud.go index 38840b41..7d052353 100644 --- a/providers/dns/nifcloud/nifcloud.go +++ b/providers/dns/nifcloud/nifcloud.go @@ -28,7 +28,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { BaseURL string AccessKey string @@ -39,7 +39,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL), @@ -51,7 +51,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider implements the challenge.Provider interface +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { client *internal.Client config *Config @@ -96,7 +96,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { return &DNSProvider{client: client, config: config}, nil } -// Present creates a TXT record using the specified parameters +// Present creates a TXT record using the specified parameters. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -107,7 +107,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return err } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/ns1/ns1.go b/providers/dns/ns1/ns1.go index 9ef80d07..136ba1b3 100644 --- a/providers/dns/ns1/ns1.go +++ b/providers/dns/ns1/ns1.go @@ -27,7 +27,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { APIKey string PropagationTimeout time.Duration @@ -36,7 +36,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL), @@ -48,7 +48,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { client *rest.Client config *Config diff --git a/providers/dns/oraclecloud/oraclecloud.go b/providers/dns/oraclecloud/oraclecloud.go index b2b9e25d..fd2fbd23 100644 --- a/providers/dns/oraclecloud/oraclecloud.go +++ b/providers/dns/oraclecloud/oraclecloud.go @@ -32,7 +32,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { CompartmentID string OCIConfigProvider common.ConfigurationProvider @@ -42,7 +42,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL), @@ -54,7 +54,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { client *dns.DnsClient config *Config @@ -100,7 +100,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { return &DNSProvider{client: &client, config: config}, nil } -// Present creates a TXT record to fulfill the dns-01 challenge +// Present creates a TXT record to fulfill the dns-01 challenge. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -135,7 +135,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/otc/mock_test.go b/providers/dns/otc/mock_test.go index f683f182..8340b250 100644 --- a/providers/dns/otc/mock_test.go +++ b/providers/dns/otc/mock_test.go @@ -12,14 +12,14 @@ import ( const fakeOTCToken = "62244bc21da68d03ebac94e6636ff01f" -// DNSServerMock mock +// DNSServerMock mock. type DNSServerMock struct { t *testing.T server *httptest.Server Mux *http.ServeMux } -// NewDNSServerMock create a new DNSServerMock +// NewDNSServerMock create a new DNSServerMock. func NewDNSServerMock(t *testing.T) *DNSServerMock { mux := http.NewServeMux() @@ -34,12 +34,12 @@ func (m *DNSServerMock) GetServerURL() string { return m.server.URL } -// ShutdownServer creates the mock server +// ShutdownServer creates the mock server. func (m *DNSServerMock) ShutdownServer() { m.server.Close() } -// HandleAuthSuccessfully Handle auth successfully +// HandleAuthSuccessfully Handle auth successfully. func (m *DNSServerMock) HandleAuthSuccessfully() { m.Mux.HandleFunc("/v3/auth/token", func(w http.ResponseWriter, _ *http.Request) { w.Header().Set("X-Subject-Token", fakeOTCToken) @@ -66,7 +66,7 @@ func (m *DNSServerMock) HandleAuthSuccessfully() { }) } -// HandleListZonesSuccessfully Handle list zones successfully +// HandleListZonesSuccessfully Handle list zones successfully. func (m *DNSServerMock) HandleListZonesSuccessfully() { m.Mux.HandleFunc("/v2/zones", func(w http.ResponseWriter, r *http.Request) { assert.Equal(m.t, r.Method, http.MethodGet) @@ -82,7 +82,7 @@ func (m *DNSServerMock) HandleListZonesSuccessfully() { }) } -// HandleListZonesEmpty Handle list zones empty +// HandleListZonesEmpty Handle list zones empty. func (m *DNSServerMock) HandleListZonesEmpty() { m.Mux.HandleFunc("/v2/zones", func(w http.ResponseWriter, r *http.Request) { assert.Equal(m.t, r.Method, http.MethodGet) @@ -97,7 +97,7 @@ func (m *DNSServerMock) HandleListZonesEmpty() { }) } -// HandleDeleteRecordsetsSuccessfully Handle delete recordsets successfully +// HandleDeleteRecordsetsSuccessfully Handle delete recordsets successfully. func (m *DNSServerMock) HandleDeleteRecordsetsSuccessfully() { m.Mux.HandleFunc("/v2/zones/123123/recordsets/321321", func(w http.ResponseWriter, r *http.Request) { assert.Equal(m.t, r.Method, http.MethodDelete) @@ -112,7 +112,7 @@ func (m *DNSServerMock) HandleDeleteRecordsetsSuccessfully() { }) } -// HandleListRecordsetsEmpty Handle list recordsets empty +// HandleListRecordsetsEmpty Handle list recordsets empty. func (m *DNSServerMock) HandleListRecordsetsEmpty() { m.Mux.HandleFunc("/v2/zones/123123/recordsets", func(w http.ResponseWriter, r *http.Request) { assert.Equal(m.t, r.URL.Path, "/v2/zones/123123/recordsets") @@ -125,7 +125,7 @@ func (m *DNSServerMock) HandleListRecordsetsEmpty() { }) } -// HandleListRecordsetsSuccessfully Handle list recordsets successfully +// HandleListRecordsetsSuccessfully Handle list recordsets successfully. func (m *DNSServerMock) HandleListRecordsetsSuccessfully() { m.Mux.HandleFunc("/v2/zones/123123/recordsets", func(w http.ResponseWriter, r *http.Request) { if r.Method == http.MethodGet { diff --git a/providers/dns/otc/otc.go b/providers/dns/otc/otc.go index a82c4497..0d139b06 100644 --- a/providers/dns/otc/otc.go +++ b/providers/dns/otc/otc.go @@ -14,7 +14,7 @@ import ( const defaultIdentityEndpoint = "https://iam.eu-de.otc.t-systems.com:443/v3/auth/tokens" -// minTTL 300 is otc minimum value for ttl +// minTTL 300 is otc minimum value for TTL. const minTTL = 300 // Environment variables names. @@ -33,7 +33,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { IdentityEndpoint string DomainName string @@ -46,7 +46,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, minTTL), @@ -74,8 +74,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface that uses -// OTC's Managed DNS API to manage TXT records for a domain. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config baseURL string @@ -121,7 +120,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { return &DNSProvider{config: config}, nil } -// Present creates a TXT record using the specified parameters +// Present creates a TXT record using the specified parameters. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -157,7 +156,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, _ := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/ovh/ovh.go b/providers/dns/ovh/ovh.go index a3e6bf8a..5e0a0e0d 100644 --- a/providers/dns/ovh/ovh.go +++ b/providers/dns/ovh/ovh.go @@ -32,7 +32,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Record a DNS record +// Record a DNS record. type Record struct { ID int64 `json:"id,omitempty"` FieldType string `json:"fieldType,omitempty"` @@ -42,7 +42,7 @@ type Record struct { Zone string `json:"zone,omitempty"` } -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { APIEndpoint string ApplicationKey string @@ -54,7 +54,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL), @@ -66,8 +66,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface -// that uses OVH's REST API to manage TXT records for a domain. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *ovh.Client @@ -76,11 +75,8 @@ type DNSProvider struct { } // NewDNSProvider returns a DNSProvider instance configured for OVH -// Credentials must be passed in the environment variable: -// OVH_ENDPOINT : it must be ovh-eu or ovh-ca -// OVH_APPLICATION_KEY -// OVH_APPLICATION_SECRET -// OVH_CONSUMER_KEY +// Credentials must be passed in the environment variables: +// OVH_ENDPOINT (must be either "ovh-eu" or "ovh-ca"), OVH_APPLICATION_KEY, OVH_APPLICATION_SECRET, OVH_CONSUMER_KEY. func NewDNSProvider() (*DNSProvider, error) { values, err := env.Get(EnvEndpoint, EnvApplicationKey, EnvApplicationSecret, EnvConsumerKey) if err != nil { @@ -162,7 +158,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, _ := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/pdns/pdns.go b/providers/dns/pdns/pdns.go index d3e97ecd..039db8ce 100644 --- a/providers/dns/pdns/pdns.go +++ b/providers/dns/pdns/pdns.go @@ -28,7 +28,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { APIKey string Host *url.URL @@ -38,7 +38,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL), @@ -50,7 +50,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { apiVersion int config *Config @@ -108,7 +108,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// Present creates a TXT record to fulfill the dns-01 challenge +// Present creates a TXT record to fulfill the dns-01 challenge. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -172,7 +172,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, _ := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/rackspace/client.go b/providers/dns/rackspace/client.go index bb2b9a86..0bf4a364 100644 --- a/providers/dns/rackspace/client.go +++ b/providers/dns/rackspace/client.go @@ -10,68 +10,68 @@ import ( "github.com/go-acme/lego/v3/challenge/dns01" ) -// APIKeyCredentials API credential +// APIKeyCredentials API credential. type APIKeyCredentials struct { Username string `json:"username"` APIKey string `json:"apiKey"` } -// Auth auth credentials +// Auth auth credentials. type Auth struct { APIKeyCredentials `json:"RAX-KSKEY:apiKeyCredentials"` } -// AuthData Auth data +// AuthData Auth data. type AuthData struct { Auth `json:"auth"` } -// Identity Identity +// Identity Identity. type Identity struct { Access Access `json:"access"` } -// Access Access +// Access Access. type Access struct { ServiceCatalog []ServiceCatalog `json:"serviceCatalog"` Token Token `json:"token"` } -// Token Token +// Token Token. type Token struct { ID string `json:"id"` } -// ServiceCatalog ServiceCatalog +// ServiceCatalog ServiceCatalog. type ServiceCatalog struct { Endpoints []Endpoint `json:"endpoints"` Name string `json:"name"` } -// Endpoint Endpoint +// Endpoint Endpoint. type Endpoint struct { PublicURL string `json:"publicURL"` TenantID string `json:"tenantId"` } -// ZoneSearchResponse represents the response when querying Rackspace DNS zones +// ZoneSearchResponse represents the response when querying Rackspace DNS zones. type ZoneSearchResponse struct { TotalEntries int `json:"totalEntries"` HostedZones []HostedZone `json:"domains"` } -// HostedZone HostedZone +// HostedZone HostedZone. type HostedZone struct { ID int `json:"id"` Name string `json:"name"` } -// Records is the list of records sent/received from the DNS API +// Records is the list of records sent/received from the DNS API. type Records struct { Record []Record `json:"records"` } -// Record represents a Rackspace DNS record +// Record represents a Rackspace DNS record. type Record struct { Name string `json:"name"` Type string `json:"type"` @@ -81,7 +81,7 @@ type Record struct { } // getHostedZoneID performs a lookup to get the DNS zone which needs -// modifying for a given FQDN +// modifying for a given FQDN. func (d *DNSProvider) getHostedZoneID(fqdn string) (int, error) { authZone, err := dns01.FindZoneByFqdn(fqdn) if err != nil { @@ -107,7 +107,7 @@ func (d *DNSProvider) getHostedZoneID(fqdn string) (int, error) { return zoneSearchResponse.HostedZones[0].ID, nil } -// findTxtRecord searches a DNS zone for a TXT record with a specific name +// findTxtRecord searches a DNS zone for a TXT record with a specific name. func (d *DNSProvider) findTxtRecord(fqdn string, zoneID int) (*Record, error) { result, err := d.makeRequest(http.MethodGet, fmt.Sprintf("/domains/%d/records?type=TXT&name=%s", zoneID, dns01.UnFqdn(fqdn)), nil) if err != nil { @@ -131,7 +131,7 @@ func (d *DNSProvider) findTxtRecord(fqdn string, zoneID int) (*Record, error) { return &records.Record[0], nil } -// makeRequest is a wrapper function used for making DNS API requests +// makeRequest is a wrapper function used for making DNS API requests. func (d *DNSProvider) makeRequest(method, uri string, body io.Reader) (json.RawMessage, error) { url := d.cloudDNSEndpoint + uri diff --git a/providers/dns/rackspace/rackspace.go b/providers/dns/rackspace/rackspace.go index dcae2eee..f94a09ee 100644 --- a/providers/dns/rackspace/rackspace.go +++ b/providers/dns/rackspace/rackspace.go @@ -13,7 +13,7 @@ import ( "github.com/go-acme/lego/v3/platform/config/env" ) -// defaultBaseURL represents the Identity API endpoint to call +// defaultBaseURL represents the Identity API endpoint to call. const defaultBaseURL = "https://identity.api.rackspacecloud.com/v2.0/tokens" // Environment variables names. @@ -29,7 +29,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { BaseURL string APIUser string @@ -40,7 +40,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ BaseURL: defaultBaseURL, @@ -53,8 +53,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface -// used to store the reusable token and DNS API endpoint +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config token string @@ -113,7 +112,7 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { }, nil } -// Present creates a TXT record to fulfill the dns-01 challenge +// Present creates a TXT record to fulfill the dns-01 challenge. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -143,7 +142,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, _ := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/regru/regru.go b/providers/dns/regru/regru.go index 12117a21..bb0a1f4f 100644 --- a/providers/dns/regru/regru.go +++ b/providers/dns/regru/regru.go @@ -37,7 +37,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, 300), @@ -49,7 +49,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *internal.Client @@ -96,7 +96,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// Present creates a TXT record using the specified parameters +// Present creates a TXT record using the specified parameters. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -115,7 +115,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/rfc2136/rfc2136.go b/providers/dns/rfc2136/rfc2136.go index 494288a0..059c9e43 100644 --- a/providers/dns/rfc2136/rfc2136.go +++ b/providers/dns/rfc2136/rfc2136.go @@ -29,7 +29,7 @@ const ( EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { Nameserver string TSIGAlgorithm string @@ -42,7 +42,7 @@ type Config struct { DNSTimeout time.Duration } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TSIGAlgorithm: env.GetOrDefaultString(EnvTSIGAlgorithm, dns.HmacMD5), @@ -54,8 +54,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface that -// uses dynamic DNS updates (RFC 2136) to create TXT records on a nameserver. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config } @@ -127,7 +126,7 @@ func (d *DNSProvider) Sequential() time.Duration { return d.config.SequenceInterval } -// Present creates a TXT record using the specified parameters +// Present creates a TXT record using the specified parameters. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -138,7 +137,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/rimuhosting/rimuhosting.go b/providers/dns/rimuhosting/rimuhosting.go index 4fcee98d..9d81adfb 100644 --- a/providers/dns/rimuhosting/rimuhosting.go +++ b/providers/dns/rimuhosting/rimuhosting.go @@ -24,7 +24,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { APIKey string @@ -34,7 +34,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, 3600), @@ -46,7 +46,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *rimuhosting.Client @@ -92,7 +92,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// Present creates a TXT record using the specified parameters +// Present creates a TXT record using the specified parameters. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -117,7 +117,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/route53/mock_test.go b/providers/dns/route53/mock_test.go index 79b0bbaf..0ae0d4ae 100644 --- a/providers/dns/route53/mock_test.go +++ b/providers/dns/route53/mock_test.go @@ -10,13 +10,13 @@ import ( "github.com/stretchr/testify/require" ) -// MockResponse represents a predefined response used by a mock server +// MockResponse represents a predefined response used by a mock server. type MockResponse struct { StatusCode int Body string } -// MockResponseMap maps request paths to responses +// MockResponseMap maps request paths to responses. type MockResponseMap map[string]MockResponse func newMockServer(t *testing.T, responses MockResponseMap) *httptest.Server { diff --git a/providers/dns/route53/route53.go b/providers/dns/route53/route53.go index 19ae4667..dffc0180 100644 --- a/providers/dns/route53/route53.go +++ b/providers/dns/route53/route53.go @@ -33,7 +33,7 @@ const ( EnvPollingInterval = envNamespace + "POLLING_INTERVAL" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { MaxRetries int TTL int @@ -43,7 +43,7 @@ type Config struct { Client *route53.Route53 } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ MaxRetries: env.GetOrDefaultInt(EnvMaxRetries, 5), @@ -54,7 +54,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider implements the challenge.Provider interface +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { client *route53.Route53 config *Config @@ -96,7 +96,7 @@ func NewDNSProvider() (*DNSProvider, error) { return NewDNSProviderConfig(NewDefaultConfig()) } -// NewDNSProviderConfig takes a given config ans returns a custom configured DNSProvider instance +// NewDNSProviderConfig takes a given config ans returns a custom configured DNSProvider instance. func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { if config == nil { return nil, errors.New("route53: the configuration of the Route53 DNS provider is nil") @@ -119,13 +119,12 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { return &DNSProvider{client: cl, config: config}, nil } -// Timeout returns the timeout and interval to use when checking for DNS -// propagation. +// Timeout returns the timeout and interval to use when checking for DNS propagation. func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// Present creates a TXT record using the specified parameters +// Present creates a TXT record using the specified parameters. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -166,7 +165,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, _ := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/sakuracloud/sakuracloud.go b/providers/dns/sakuracloud/sakuracloud.go index 54f9dced..1770ba47 100644 --- a/providers/dns/sakuracloud/sakuracloud.go +++ b/providers/dns/sakuracloud/sakuracloud.go @@ -25,7 +25,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { Token string Secret string @@ -35,7 +35,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL), @@ -47,14 +47,15 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *api.DNSAPI } // NewDNSProvider returns a DNSProvider instance configured for SakuraCloud. -// Credentials must be passed in the environment variables: SAKURACLOUD_ACCESS_TOKEN & SAKURACLOUD_ACCESS_TOKEN_SECRET +// Credentials must be passed in the environment variables: +// SAKURACLOUD_ACCESS_TOKEN & SAKURACLOUD_ACCESS_TOKEN_SECRET. func NewDNSProvider() (*DNSProvider, error) { values, err := env.Get(EnvAccessToken, EnvAccessTokenSecret) if err != nil { diff --git a/providers/dns/scaleway/internal/client.go b/providers/dns/scaleway/internal/client.go index daf3f9f6..65f5e348 100644 --- a/providers/dns/scaleway/internal/client.go +++ b/providers/dns/scaleway/internal/client.go @@ -25,7 +25,7 @@ func (a APIError) Error() string { return a.Message } -// Record represents a DNS record +// Record represents a DNS record. type Record struct { Data string `json:"data,omitempty"` Name string `json:"name,omitempty"` diff --git a/providers/dns/scaleway/scaleway.go b/providers/dns/scaleway/scaleway.go index 1be072c3..21076d41 100644 --- a/providers/dns/scaleway/scaleway.go +++ b/providers/dns/scaleway/scaleway.go @@ -61,7 +61,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *internal.Client diff --git a/providers/dns/selectel/selectel.go b/providers/dns/selectel/selectel.go index 53fd02e2..d219ae8d 100644 --- a/providers/dns/selectel/selectel.go +++ b/providers/dns/selectel/selectel.go @@ -52,7 +52,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *selectel.Client diff --git a/providers/dns/servercow/internal/model.go b/providers/dns/servercow/internal/model.go index 50804dc6..5a8fb6ff 100644 --- a/providers/dns/servercow/internal/model.go +++ b/providers/dns/servercow/internal/model.go @@ -12,7 +12,7 @@ type Record struct { } // Value is the value of a record. -// Allows to handle dynamic type (string and string array) +// Allows to handle dynamic type (string and string array). type Value []string func (v Value) MarshalJSON() ([]byte, error) { diff --git a/providers/dns/servercow/servercow.go b/providers/dns/servercow/servercow.go index a8634aa7..9a79ec0d 100644 --- a/providers/dns/servercow/servercow.go +++ b/providers/dns/servercow/servercow.go @@ -38,7 +38,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, defaultTTL), @@ -50,7 +50,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider implements challenge.Provider for the Servercow API. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *internal.Client diff --git a/providers/dns/stackpath/client.go b/providers/dns/stackpath/client.go index b16e6e6a..88680e2e 100644 --- a/providers/dns/stackpath/client.go +++ b/providers/dns/stackpath/client.go @@ -13,23 +13,23 @@ import ( "golang.org/x/net/publicsuffix" ) -// Zones is the response struct from the Stackpath api GetZones +// Zones is the response struct from the Stackpath api GetZones. type Zones struct { Zones []Zone `json:"zones"` } -// Zone a DNS zone representation +// Zone a DNS zone representation. type Zone struct { ID string Domain string } -// Records is the response struct from the Stackpath api GetZoneRecords +// Records is the response struct from the Stackpath api GetZoneRecords. type Records struct { Records []Record `json:"records"` } -// Record a DNS record representation +// Record a DNS record representation. type Record struct { ID string `json:"id,omitempty"` Name string `json:"name"` @@ -38,7 +38,7 @@ type Record struct { Data string `json:"data"` } -// ErrorResponse the API error response representation +// ErrorResponse the API error response representation. type ErrorResponse struct { Code int `json:"code"` Message string `json:"error"` diff --git a/providers/dns/stackpath/stackpath.go b/providers/dns/stackpath/stackpath.go index 6ff54cdf..2f91bd59 100644 --- a/providers/dns/stackpath/stackpath.go +++ b/providers/dns/stackpath/stackpath.go @@ -35,7 +35,7 @@ const ( EnvPollingInterval = envNamespace + "POLLING_INTERVAL" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { ClientID string ClientSecret string @@ -45,7 +45,7 @@ type Config struct { PollingInterval time.Duration } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, 120), @@ -54,7 +54,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { BaseURL *url.URL client *http.Client @@ -111,7 +111,7 @@ func getOathClient(config *Config) *http.Client { return oathConfig.Client(context.Background()) } -// Present creates a TXT record to fulfill the dns-01 challenge +// Present creates a TXT record to fulfill the dns-01 challenge. func (d *DNSProvider) Present(domain, token, keyAuth string) error { zone, err := d.getZones(domain) if err != nil { @@ -131,7 +131,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return d.createZoneRecord(zone, record) } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { zone, err := d.getZones(domain) if err != nil { diff --git a/providers/dns/transip/transip.go b/providers/dns/transip/transip.go index afa0612b..13a3a59d 100644 --- a/providers/dns/transip/transip.go +++ b/providers/dns/transip/transip.go @@ -25,7 +25,7 @@ const ( EnvPollingInterval = envNamespace + "POLLING_INTERVAL" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { AccountName string PrivateKeyPath string @@ -34,7 +34,7 @@ type Config struct { TTL int64 } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: int64(env.GetOrDefaultInt(EnvTTL, 10)), @@ -43,7 +43,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider describes a provider for TransIP +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config repository transipdomain.Repository @@ -90,7 +90,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// Present creates a TXT record to fulfill the dns-01 challenge +// Present creates a TXT record to fulfill the dns-01 challenge. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -119,7 +119,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/vegadns/vegadns.go b/providers/dns/vegadns/vegadns.go index aeae3dfc..c55ec72f 100644 --- a/providers/dns/vegadns/vegadns.go +++ b/providers/dns/vegadns/vegadns.go @@ -25,7 +25,7 @@ const ( EnvPollingInterval = envNamespace + "POLLING_INTERVAL" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { BaseURL string APIKey string @@ -35,7 +35,7 @@ type Config struct { TTL int } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, 10), @@ -44,7 +44,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider describes a provider for VegaDNS +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client vegaClient.VegaDNSClient @@ -86,7 +86,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// Present creates a TXT record to fulfill the dns-01 challenge +// Present creates a TXT record to fulfill the dns-01 challenge. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -102,7 +102,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, _ := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/versio/versio.go b/providers/dns/versio/versio.go index 12cde1ed..938d86da 100644 --- a/providers/dns/versio/versio.go +++ b/providers/dns/versio/versio.go @@ -28,7 +28,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { BaseURL *url.URL TTL int @@ -40,7 +40,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { baseURL, err := url.Parse(env.GetOrDefaultString(EnvEndpoint, defaultBaseURL)) if err != nil { @@ -59,7 +59,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider describes a provider for acme-proxy +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config dnsEntriesMu sync.Mutex @@ -100,7 +100,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// Present creates a TXT record to fulfill the dns-01 challenge +// Present creates a TXT record to fulfill the dns-01 challenge. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -136,7 +136,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, _ := dns01.GetRecord(domain, keyAuth) authZone, err := dns01.FindZoneByFqdn(fqdn) diff --git a/providers/dns/vscale/vscale.go b/providers/dns/vscale/vscale.go index 84f424d6..792ce871 100644 --- a/providers/dns/vscale/vscale.go +++ b/providers/dns/vscale/vscale.go @@ -52,7 +52,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *selectel.Client diff --git a/providers/dns/vultr/vultr.go b/providers/dns/vultr/vultr.go index fca5222f..f1c915a2 100644 --- a/providers/dns/vultr/vultr.go +++ b/providers/dns/vultr/vultr.go @@ -29,7 +29,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { APIKey string PropagationTimeout time.Duration @@ -38,7 +38,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL), @@ -54,7 +54,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *govultr.Client diff --git a/providers/dns/yandex/yandex.go b/providers/dns/yandex/yandex.go index 88a9f1ba..045020e8 100644 --- a/providers/dns/yandex/yandex.go +++ b/providers/dns/yandex/yandex.go @@ -27,7 +27,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { PddToken string PropagationTimeout time.Duration @@ -36,7 +36,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, defaultTTL), @@ -48,7 +48,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { client *internal.Client config *Config diff --git a/providers/dns/zoneee/zoneee.go b/providers/dns/zoneee/zoneee.go index d568078e..9079aeaf 100644 --- a/providers/dns/zoneee/zoneee.go +++ b/providers/dns/zoneee/zoneee.go @@ -25,7 +25,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { Endpoint *url.URL Username string @@ -35,7 +35,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { endpoint, _ := url.Parse(defaultEndpoint) @@ -50,7 +50,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider describes a provider for acme-proxy +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config } @@ -76,7 +76,7 @@ func NewDNSProvider() (*DNSProvider, error) { return NewDNSProviderConfig(config) } -// NewDNSProviderConfig return a DNSProvider instance configured for Zone.ee +// NewDNSProviderConfig return a DNSProvider instance configured for Zone.ee. func NewDNSProviderConfig(config *Config) (*DNSProvider, error) { if config == nil { return nil, errors.New("zoneee: the configuration of the DNS provider is nil") @@ -103,7 +103,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// Present creates a TXT record to fulfill the dns-01 challenge +// Present creates a TXT record to fulfill the dns-01 challenge. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -124,7 +124,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record previously created +// CleanUp removes the TXT record previously created. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { _, value := dns01.GetRecord(domain, keyAuth) diff --git a/providers/dns/zonomi/zonomi.go b/providers/dns/zonomi/zonomi.go index 688e1619..57d9f2a2 100644 --- a/providers/dns/zonomi/zonomi.go +++ b/providers/dns/zonomi/zonomi.go @@ -24,7 +24,7 @@ const ( EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" ) -// Config is used to configure the creation of the DNSProvider +// Config is used to configure the creation of the DNSProvider. type Config struct { APIKey string @@ -34,7 +34,7 @@ type Config struct { HTTPClient *http.Client } -// NewDefaultConfig returns a default configuration for the DNSProvider +// NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, 3600), @@ -46,7 +46,7 @@ func NewDefaultConfig() *Config { } } -// DNSProvider is an implementation of the challenge.Provider interface. +// DNSProvider implements the challenge.Provider interface. type DNSProvider struct { config *Config client *rimuhosting.Client @@ -92,7 +92,7 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) { return d.config.PropagationTimeout, d.config.PollingInterval } -// Present creates a TXT record using the specified parameters +// Present creates a TXT record using the specified parameters. func (d *DNSProvider) Present(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) @@ -117,7 +117,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the TXT record matching the specified parameters +// CleanUp removes the TXT record matching the specified parameters. func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { fqdn, value := dns01.GetRecord(domain, keyAuth) diff --git a/providers/http/memcached/memcached.go b/providers/http/memcached/memcached.go index 03552a95..09b448df 100644 --- a/providers/http/memcached/memcached.go +++ b/providers/http/memcached/memcached.go @@ -11,12 +11,12 @@ import ( "github.com/rainycape/memcache" ) -// HTTPProvider implements HTTPProvider for `http-01` challenge +// HTTPProvider implements HTTPProvider for `http-01` challenge. type HTTPProvider struct { hosts []string } -// NewMemcachedProvider returns a HTTPProvider instance with a configured webroot path +// NewMemcachedProvider returns a HTTPProvider instance with a configured webroot path. func NewMemcachedProvider(hosts []string) (*HTTPProvider, error) { if len(hosts) == 0 { return nil, errors.New("no memcached hosts provided") @@ -29,7 +29,7 @@ func NewMemcachedProvider(hosts []string) (*HTTPProvider, error) { return c, nil } -// Present makes the token available at `HTTP01ChallengePath(token)` by creating a file in the given webroot path +// Present makes the token available at `HTTP01ChallengePath(token)` by creating a file in the given webroot path. func (w *HTTPProvider) Present(domain, token, keyAuth string) error { var errs []error @@ -54,7 +54,7 @@ func (w *HTTPProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the file created for the challenge +// CleanUp removes the file created for the challenge. func (w *HTTPProvider) CleanUp(domain, token, keyAuth string) error { // Memcached will clean up itself, that's what expiration is for. return nil diff --git a/providers/http/webroot/webroot.go b/providers/http/webroot/webroot.go index e2e829e6..83e95b85 100644 --- a/providers/http/webroot/webroot.go +++ b/providers/http/webroot/webroot.go @@ -11,12 +11,12 @@ import ( "github.com/go-acme/lego/v3/challenge/http01" ) -// HTTPProvider implements ChallengeProvider for `http-01` challenge +// HTTPProvider implements ChallengeProvider for `http-01` challenge. type HTTPProvider struct { path string } -// NewHTTPProvider returns a HTTPProvider instance with a configured webroot path +// NewHTTPProvider returns a HTTPProvider instance with a configured webroot path. func NewHTTPProvider(path string) (*HTTPProvider, error) { if _, err := os.Stat(path); os.IsNotExist(err) { return nil, errors.New("webroot path does not exist") @@ -25,7 +25,7 @@ func NewHTTPProvider(path string) (*HTTPProvider, error) { return &HTTPProvider{path: path}, nil } -// Present makes the token available at `HTTP01ChallengePath(token)` by creating a file in the given webroot path +// Present makes the token available at `HTTP01ChallengePath(token)` by creating a file in the given webroot path. func (w *HTTPProvider) Present(domain, token, keyAuth string) error { var err error @@ -43,7 +43,7 @@ func (w *HTTPProvider) Present(domain, token, keyAuth string) error { return nil } -// CleanUp removes the file created for the challenge +// CleanUp removes the file created for the challenge. func (w *HTTPProvider) CleanUp(domain, token, keyAuth string) error { err := os.Remove(filepath.Join(w.path, http01.ChallengePath(token))) if err != nil {