chore: update linter. (#1145)

This commit is contained in:
Ludovic Fernandez 2020-05-08 19:35:25 +02:00 committed by GitHub
parent e90786484a
commit 6043c9347c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
131 changed files with 579 additions and 576 deletions

View file

@ -34,6 +34,9 @@
"stylecheck",
"godox",
"gomnd",
"testpackage", # not relevant
"nestif", # too many false-positive
"goerr113", # not relevant
]
[issues]

View file

@ -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)
}

View file

@ -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

View file

@ -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

View file

@ -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 ""

View file

@ -4,7 +4,7 @@ import (
"fmt"
)
// Errors types
// Errors types.
const (
errNS = "urn:ietf:params:acme:error:"
BadNonceErr = errNS + "badNonce"

View file

@ -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}

View file

@ -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 {

View file

@ -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

View file

@ -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)

View file

@ -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 {

View file

@ -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 := ""

View file

@ -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
}

View file

@ -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":

View file

@ -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

View file

@ -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
}

View file

@ -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 {

View file

@ -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(),

View file

@ -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) {

View file

@ -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
```

View file

@ -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
}

View file

@ -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{

View file

@ -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{}

View file

@ -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

View file

@ -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 {

View file

@ -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)

View file

@ -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)

View file

@ -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"`

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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
}

View file

@ -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 (

View file

@ -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")

View file

@ -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)

View file

@ -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

View file

@ -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 {

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -5,7 +5,7 @@ import (
"strings"
)
// Search filters
// Search filters.
const (
StartsWith searchFilter = "startswith"
Exact searchFilter = "exact"

View file

@ -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

View file

@ -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,

View file

@ -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)

View file

@ -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"`
}

View file

@ -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)

View file

@ -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":

View file

@ -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) {

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -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)

View file

@ -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 {

View file

@ -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)

View file

@ -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)

View file

@ -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)
}

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -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)

View file

@ -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" {

View file

@ -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 {

View file

@ -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)

View file

@ -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{}

View file

@ -1,7 +1,7 @@
package gandi
// CleanUp Request->Response 1 (setZone)
const cleanup1RequestMock = `<?xml version="1.0"?>
// CleanUp Request->Response 1 (setZone).
const cleanupSetZoneRequestMock = `<?xml version="1.0"?>
<methodCall>
<methodName>domain.zone.set</methodName>
<param>
@ -21,8 +21,8 @@ const cleanup1RequestMock = `<?xml version="1.0"?>
</param>
</methodCall>`
// CleanUp Request->Response 1 (setZone)
const cleanup1ResponseMock = `<?xml version='1.0'?>
// CleanUp Request->Response 1 (setZone).
const cleanupSetZoneResponseMock = `<?xml version='1.0'?>
<methodResponse>
<params>
<param>
@ -191,8 +191,8 @@ const cleanup1ResponseMock = `<?xml version='1.0'?>
</methodResponse>
`
// CleanUp Request->Response 2 (deleteZone)
const cleanup2RequestMock = `<?xml version="1.0"?>
// CleanUp Request->Response 2 (deleteZone).
const cleanupDeleteZoneRequestMock = `<?xml version="1.0"?>
<methodCall>
<methodName>domain.zone.delete</methodName>
<param>
@ -207,8 +207,8 @@ const cleanup2RequestMock = `<?xml version="1.0"?>
</param>
</methodCall>`
// CleanUp Request->Response 2 (deleteZone)
const cleanup2ResponseMock = `<?xml version='1.0'?>
// CleanUp Request->Response 2 (deleteZone).
const cleanupDeleteZoneResponseMock = `<?xml version='1.0'?>
<methodResponse>
<params>
<param>
@ -218,8 +218,8 @@ const cleanup2ResponseMock = `<?xml version='1.0'?>
</methodResponse>
`
// Present Request->Response 1 (getZoneID)
const present1RequestMock = `<?xml version="1.0"?>
// Present Request->Response 1 (getZoneID).
const presentGetZoneIDRequestMock = `<?xml version="1.0"?>
<methodCall>
<methodName>domain.info</methodName>
<param>
@ -234,8 +234,8 @@ const present1RequestMock = `<?xml version="1.0"?>
</param>
</methodCall>`
// Present Request->Response 1 (getZoneID)
const present1ResponseMock = `<?xml version='1.0'?>
// Present Request->Response 1 (getZoneID).
const presentGetZoneIDResponseMock = `<?xml version='1.0'?>
<methodResponse>
<params>
<param>
@ -404,8 +404,8 @@ const present1ResponseMock = `<?xml version='1.0'?>
</methodResponse>
`
// Present Request->Response 2 (cloneZone)
const present2RequestMock = `<?xml version="1.0"?>
// Present Request->Response 2 (cloneZone).
const presentCloneZoneRequestMock = `<?xml version="1.0"?>
<methodCall>
<methodName>domain.zone.clone</methodName>
<param>
@ -437,8 +437,8 @@ const present2RequestMock = `<?xml version="1.0"?>
</param>
</methodCall>`
// Present Request->Response 2 (cloneZone)
const present2ResponseMock = `<?xml version='1.0'?>
// Present Request->Response 2 (cloneZone).
const presentCloneZoneResponseMock = `<?xml version='1.0'?>
<methodResponse>
<params>
<param>
@ -483,8 +483,8 @@ const present2ResponseMock = `<?xml version='1.0'?>
</methodResponse>
`
// Present Request->Response 3 (newZoneVersion)
const present3RequestMock = `<?xml version="1.0"?>
// Present Request->Response 3 (newZoneVersion).
const presentNewZoneVersionRequestMock = `<?xml version="1.0"?>
<methodCall>
<methodName>domain.zone.version.new</methodName>
<param>
@ -499,8 +499,8 @@ const present3RequestMock = `<?xml version="1.0"?>
</param>
</methodCall>`
// Present Request->Response 3 (newZoneVersion)
const present3ResponseMock = `<?xml version='1.0'?>
// Present Request->Response 3 (newZoneVersion).
const presentNewZoneVersionResponseMock = `<?xml version='1.0'?>
<methodResponse>
<params>
<param>
@ -510,8 +510,8 @@ const present3ResponseMock = `<?xml version='1.0'?>
</methodResponse>
`
// Present Request->Response 4 (addTXTRecord)
const present4RequestMock = `<?xml version="1.0"?>
// Present Request->Response 4 (addTXTRecord).
const presentAddTXTRecordRequestMock = `<?xml version="1.0"?>
<methodCall>
<methodName>domain.zone.record.add</methodName>
<param>
@ -561,8 +561,8 @@ const present4RequestMock = `<?xml version="1.0"?>
</param>
</methodCall>`
// Present Request->Response 4 (addTXTRecord)
const present4ResponseMock = `<?xml version='1.0'?>
// Present Request->Response 4 (addTXTRecord).
const presentAddTXTRecordResponseMock = `<?xml version='1.0'?>
<methodResponse>
<params>
<param>
@ -593,8 +593,8 @@ const present4ResponseMock = `<?xml version='1.0'?>
</methodResponse>
`
// Present Request->Response 5 (setZoneVersion)
const present5RequestMock = `<?xml version="1.0"?>
// Present Request->Response 5 (setZoneVersion).
const presentSetZoneVersionRequestMock = `<?xml version="1.0"?>
<methodCall>
<methodName>domain.zone.version.set</methodName>
<param>
@ -614,8 +614,8 @@ const present5RequestMock = `<?xml version="1.0"?>
</param>
</methodCall>`
// Present Request->Response 5 (setZoneVersion)
const present5ResponseMock = `<?xml version='1.0'?>
// Present Request->Response 5 (setZoneVersion).
const presentSetZoneVersionResponseMock = `<?xml version='1.0'?>
<methodResponse>
<params>
<param>
@ -625,8 +625,8 @@ const present5ResponseMock = `<?xml version='1.0'?>
</methodResponse>
`
// Present Request->Response 6 (setZone)
const present6RequestMock = `<?xml version="1.0"?>
// Present Request->Response 6 (setZone).
const presentSetZoneRequestMock = `<?xml version="1.0"?>
<methodCall>
<methodName>domain.zone.set</methodName>
<param>
@ -646,8 +646,8 @@ const present6RequestMock = `<?xml version="1.0"?>
</param>
</methodCall>`
// Present Request->Response 6 (setZone)
const present6ResponseMock = `<?xml version='1.0'?>
// Present Request->Response 6 (setZone).
const presentSetZoneResponseMock = `<?xml version='1.0'?>
<methodResponse>
<params>
<param>

View file

@ -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"

View file

@ -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"`

View file

@ -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
}

View file

@ -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 {

View file

@ -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

View file

@ -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"`

View file

@ -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)

View file

@ -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"

View file

@ -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

View file

@ -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)

View file

@ -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{

View file

@ -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)

View file

@ -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"`

View file

@ -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)

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -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),

View file

@ -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),

View file

@ -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]

View file

@ -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")

View file

@ -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)

View file

@ -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
}

View file

@ -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 {

View file

@ -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

View file

@ -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 {

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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)

Some files were not shown because too many files have changed in this diff Show more