1
0
mirror of https://github.com/go-acme/lego.git synced 2025-07-14 19:04:19 +02:00

chore: check DNSProvider interface (#2352)

This commit is contained in:
Ludovic Fernandez
2024-11-15 23:21:21 +01:00
committed by GitHub
parent 5987820520
commit a628db57d9
144 changed files with 643 additions and 206 deletions

View File

@ -7,6 +7,7 @@ import (
"fmt" "fmt"
"github.com/cpu/goacmedns" "github.com/cpu/goacmedns"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
) )
@ -23,6 +24,8 @@ const (
EnvStoragePath = envNamespace + "STORAGE_PATH" EnvStoragePath = envNamespace + "STORAGE_PATH"
) )
var _ challenge.Provider = (*DNSProvider)(nil)
// acmeDNSClient is an interface describing the goacmedns.Client functions the DNSProvider uses. // acmeDNSClient is an interface describing the goacmedns.Client functions the DNSProvider uses.
// It makes it easier for tests to shim a mock Client into the DNSProvider. // It makes it easier for tests to shim a mock Client into the DNSProvider.
type acmeDNSClient interface { type acmeDNSClient interface {

View File

@ -11,13 +11,12 @@ import (
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials"
"github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
"github.com/aliyun/alibaba-cloud-sdk-go/services/alidns" "github.com/aliyun/alibaba-cloud-sdk-go/services/alidns"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"golang.org/x/net/idna" "golang.org/x/net/idna"
) )
const defaultRegionID = "cn-hangzhou"
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "ALICLOUD_" envNamespace = "ALICLOUD_"
@ -34,6 +33,10 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
const defaultRegionID = "cn-hangzhou"
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
RAMRole string RAMRole string

View File

@ -9,6 +9,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/allinkl/internal" "github.com/go-acme/lego/v4/providers/dns/allinkl/internal"
@ -26,6 +27,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Login string Login string

View File

@ -9,13 +9,12 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/arvancloud/internal" "github.com/go-acme/lego/v4/providers/dns/arvancloud/internal"
) )
const minTTL = 600
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "ARVANCLOUD_" envNamespace = "ARVANCLOUD_"
@ -28,6 +27,10 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
const minTTL = 600
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIKey string APIKey string

View File

@ -7,13 +7,12 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/nrdcg/auroradns" "github.com/nrdcg/auroradns"
) )
const defaultBaseURL = "https://api.auroradns.eu"
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "AURORA_" envNamespace = "AURORA_"
@ -27,6 +26,10 @@ const (
EnvPollingInterval = envNamespace + "POLLING_INTERVAL" EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
) )
const defaultBaseURL = "https://api.auroradns.eu"
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
BaseURL string BaseURL string

View File

@ -9,6 +9,7 @@ import (
"net/url" "net/url"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/autodns/internal" "github.com/go-acme/lego/v4/providers/dns/autodns/internal"
@ -29,6 +30,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Endpoint *url.URL Endpoint *url.URL

View File

@ -18,8 +18,6 @@ import (
"github.com/go-acme/lego/v4/providers/dns/internal/errutils" "github.com/go-acme/lego/v4/providers/dns/internal/errutils"
) )
const defaultMetadataEndpoint = "http://169.254.169.254"
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "AZURE_" envNamespace = "AZURE_"
@ -39,6 +37,10 @@ const (
EnvPollingInterval = envNamespace + "POLLING_INTERVAL" EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
) )
const defaultMetadataEndpoint = "http://169.254.169.254"
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
ZoneName string ZoneName string

View File

@ -51,6 +51,8 @@ const (
EnvGitHubOIDCRequestToken = "ACTIONS_ID_TOKEN_REQUEST_TOKEN" EnvGitHubOIDCRequestToken = "ACTIONS_ID_TOKEN_REQUEST_TOKEN"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
ZoneName string ZoneName string

View File

@ -12,9 +12,12 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
) )
var _ challenge.ProviderTimeout = (*DNSProviderPrivate)(nil)
// DNSProviderPrivate implements the challenge.Provider interface for Azure Private Zone DNS. // DNSProviderPrivate implements the challenge.Provider interface for Azure Private Zone DNS.
type DNSProviderPrivate struct { type DNSProviderPrivate struct {
config *Config config *Config

View File

@ -12,9 +12,12 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
) )
var _ challenge.ProviderTimeout = (*DNSProviderPublic)(nil)
// DNSProviderPublic implements the challenge.Provider interface for Azure Public Zone DNS. // DNSProviderPublic implements the challenge.Provider interface for Azure Public Zone DNS.
type DNSProviderPublic struct { type DNSProviderPublic struct {
config *Config config *Config

View File

@ -7,6 +7,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/labbsr0x/bindman-dns-webhook/src/client" "github.com/labbsr0x/bindman-dns-webhook/src/client"
@ -23,6 +24,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
PropagationTimeout time.Duration PropagationTimeout time.Duration

View File

@ -8,6 +8,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/log" "github.com/go-acme/lego/v4/log"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
@ -32,6 +33,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
BaseURL string BaseURL string

View File

@ -9,6 +9,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/brandit/internal" "github.com/go-acme/lego/v4/providers/dns/brandit/internal"
@ -27,6 +28,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIKey string APIKey string

View File

@ -7,13 +7,12 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/nrdcg/bunny-go" "github.com/nrdcg/bunny-go"
) )
const minTTL = 60
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "BUNNY_" envNamespace = "BUNNY_"
@ -25,6 +24,10 @@ const (
EnvPollingInterval = envNamespace + "POLLING_INTERVAL" EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
) )
const minTTL = 60
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIKey string APIKey string

View File

@ -9,6 +9,7 @@ import (
"net/url" "net/url"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/checkdomain/internal" "github.com/go-acme/lego/v4/providers/dns/checkdomain/internal"
@ -27,6 +28,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Endpoint *url.URL Endpoint *url.URL

View File

@ -7,16 +7,11 @@ import (
"time" "time"
"github.com/civo/civogo" "github.com/civo/civogo"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
) )
const (
minTTL = 600
defaultPollingInterval = 30 * time.Second
defaultPropagationTimeout = 300 * time.Second
)
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "CIVO_" envNamespace = "CIVO_"
@ -28,6 +23,14 @@ const (
EnvPollingInterval = envNamespace + "POLLING_INTERVAL" EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
) )
const (
minTTL = 600
defaultPollingInterval = 30 * time.Second
defaultPropagationTimeout = 300 * time.Second
)
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
ProjectID string ProjectID string

View File

@ -8,6 +8,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/clouddns/internal" "github.com/go-acme/lego/v4/providers/dns/clouddns/internal"
@ -27,6 +28,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the DNSProvider. // Config is used to configure the DNSProvider.
type Config struct { type Config struct {
ClientID string ClientID string

View File

@ -6,19 +6,45 @@ import (
"errors" "errors"
"fmt" "fmt"
"net/http" "net/http"
"strconv"
"strings"
"sync" "sync"
"time" "time"
"github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/log" "github.com/go-acme/lego/v4/log"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
) )
// Environment variables names.
const (
envNamespace = "CLOUDFLARE_"
EnvEmail = envNamespace + "EMAIL"
EnvAPIKey = envNamespace + "API_KEY"
EnvDNSAPIToken = envNamespace + "DNS_API_TOKEN"
EnvZoneAPIToken = envNamespace + "ZONE_API_TOKEN"
EnvTTL = envNamespace + "TTL"
EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT"
EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
)
const (
altEnvNamespace = "CF_"
altEnvEmail = altEnvNamespace + "API_EMAIL"
)
const ( const (
minTTL = 120 minTTL = 120
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
AuthEmail string AuthEmail string
@ -36,11 +62,11 @@ type Config struct {
// NewDefaultConfig returns a default configuration for the DNSProvider. // NewDefaultConfig returns a default configuration for the DNSProvider.
func NewDefaultConfig() *Config { func NewDefaultConfig() *Config {
return &Config{ return &Config{
TTL: env.GetOrDefaultInt("CLOUDFLARE_TTL", minTTL), TTL: env.GetOneWithFallback(EnvTTL, minTTL, strconv.Atoi, altEnvName(EnvTTL)),
PropagationTimeout: env.GetOrDefaultSecond("CLOUDFLARE_PROPAGATION_TIMEOUT", 2*time.Minute), PropagationTimeout: env.GetOneWithFallback(EnvPropagationTimeout, 2*time.Minute, env.ParseSecond, altEnvName(EnvPropagationTimeout)),
PollingInterval: env.GetOrDefaultSecond("CLOUDFLARE_POLLING_INTERVAL", 2*time.Second), PollingInterval: env.GetOneWithFallback(EnvPollingInterval, 2*time.Second, env.ParseSecond, altEnvName(EnvPollingInterval)),
HTTPClient: &http.Client{ HTTPClient: &http.Client{
Timeout: env.GetOrDefaultSecond("CLOUDFLARE_HTTP_TIMEOUT", 30*time.Second), Timeout: env.GetOneWithFallback(EnvHTTPTimeout, 30*time.Second, env.ParseSecond, altEnvName(EnvHTTPTimeout)),
}, },
} }
} }
@ -68,14 +94,14 @@ type DNSProvider struct {
// in this case pass both CLOUDFLARE_ZONE_API_TOKEN and CLOUDFLARE_DNS_API_TOKEN accordingly. // in this case pass both CLOUDFLARE_ZONE_API_TOKEN and CLOUDFLARE_DNS_API_TOKEN accordingly.
func NewDNSProvider() (*DNSProvider, error) { func NewDNSProvider() (*DNSProvider, error) {
values, err := env.GetWithFallback( values, err := env.GetWithFallback(
[]string{"CLOUDFLARE_EMAIL", "CF_API_EMAIL"}, []string{EnvEmail, altEnvEmail},
[]string{"CLOUDFLARE_API_KEY", "CF_API_KEY"}, []string{EnvAPIKey, altEnvName(EnvAPIKey)},
) )
if err != nil { if err != nil {
var errT error var errT error
values, errT = env.GetWithFallback( values, errT = env.GetWithFallback(
[]string{"CLOUDFLARE_DNS_API_TOKEN", "CF_DNS_API_TOKEN"}, []string{EnvDNSAPIToken, altEnvName(EnvDNSAPIToken)},
[]string{"CLOUDFLARE_ZONE_API_TOKEN", "CF_ZONE_API_TOKEN", "CLOUDFLARE_DNS_API_TOKEN", "CF_DNS_API_TOKEN"}, []string{EnvZoneAPIToken, altEnvName(EnvZoneAPIToken), EnvDNSAPIToken, altEnvName(EnvDNSAPIToken)},
) )
if errT != nil { if errT != nil {
//nolint:errorlint //nolint:errorlint
@ -84,10 +110,10 @@ func NewDNSProvider() (*DNSProvider, error) {
} }
config := NewDefaultConfig() config := NewDefaultConfig()
config.AuthEmail = values["CLOUDFLARE_EMAIL"] config.AuthEmail = values[EnvEmail]
config.AuthKey = values["CLOUDFLARE_API_KEY"] config.AuthKey = values[EnvAPIKey]
config.AuthToken = values["CLOUDFLARE_DNS_API_TOKEN"] config.AuthToken = values[EnvDNSAPIToken]
config.ZoneToken = values["CLOUDFLARE_ZONE_API_TOKEN"] config.ZoneToken = values[EnvZoneAPIToken]
return NewDNSProviderConfig(config) return NewDNSProviderConfig(config)
} }
@ -189,3 +215,7 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
return nil return nil
} }
func altEnvName(v string) string {
return strings.ReplaceAll(v, envNamespace, altEnvNamespace)
}

View File

@ -9,12 +9,18 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
const envDomain = envNamespace + "DOMAIN"
var envTest = tester.NewEnvTest( var envTest = tester.NewEnvTest(
"CLOUDFLARE_EMAIL", EnvEmail,
"CLOUDFLARE_API_KEY", EnvAPIKey,
"CLOUDFLARE_DNS_API_TOKEN", EnvDNSAPIToken,
"CLOUDFLARE_ZONE_API_TOKEN"). EnvZoneAPIToken,
WithDomain("CLOUDFLARE_DOMAIN") altEnvEmail,
altEnvName(EnvAPIKey),
altEnvName(EnvDNSAPIToken),
altEnvName(EnvZoneAPIToken)).
WithDomain(envDomain)
func TestNewDNSProvider(t *testing.T) { func TestNewDNSProvider(t *testing.T) {
testCases := []struct { testCases := []struct {
@ -25,45 +31,45 @@ func TestNewDNSProvider(t *testing.T) {
{ {
desc: "success email, API key", desc: "success email, API key",
envVars: map[string]string{ envVars: map[string]string{
"CLOUDFLARE_EMAIL": "test@example.com", EnvEmail: "test@example.com",
"CLOUDFLARE_API_KEY": "123", EnvAPIKey: "123",
}, },
}, },
{ {
desc: "success API token", desc: "success API token",
envVars: map[string]string{ envVars: map[string]string{
"CLOUDFLARE_DNS_API_TOKEN": "012345abcdef", EnvDNSAPIToken: "012345abcdef",
}, },
}, },
{ {
desc: "success separate API tokens", desc: "success separate API tokens",
envVars: map[string]string{ envVars: map[string]string{
"CLOUDFLARE_DNS_API_TOKEN": "012345abcdef", EnvDNSAPIToken: "012345abcdef",
"CLOUDFLARE_ZONE_API_TOKEN": "abcdef012345", EnvZoneAPIToken: "abcdef012345",
}, },
}, },
{ {
desc: "missing credentials", desc: "missing credentials",
envVars: map[string]string{ envVars: map[string]string{
"CLOUDFLARE_EMAIL": "", EnvEmail: "",
"CLOUDFLARE_API_KEY": "", EnvAPIKey: "",
"CLOUDFLARE_DNS_API_TOKEN": "", EnvDNSAPIToken: "",
}, },
expected: "cloudflare: some credentials information are missing: CLOUDFLARE_EMAIL,CLOUDFLARE_API_KEY or some credentials information are missing: CLOUDFLARE_DNS_API_TOKEN,CLOUDFLARE_ZONE_API_TOKEN", expected: "cloudflare: some credentials information are missing: CLOUDFLARE_EMAIL,CLOUDFLARE_API_KEY or some credentials information are missing: CLOUDFLARE_DNS_API_TOKEN,CLOUDFLARE_ZONE_API_TOKEN",
}, },
{ {
desc: "missing email", desc: "missing email",
envVars: map[string]string{ envVars: map[string]string{
"CLOUDFLARE_EMAIL": "", EnvEmail: "",
"CLOUDFLARE_API_KEY": "key", EnvAPIKey: "key",
}, },
expected: "cloudflare: some credentials information are missing: CLOUDFLARE_EMAIL or some credentials information are missing: CLOUDFLARE_DNS_API_TOKEN,CLOUDFLARE_ZONE_API_TOKEN", expected: "cloudflare: some credentials information are missing: CLOUDFLARE_EMAIL or some credentials information are missing: CLOUDFLARE_DNS_API_TOKEN,CLOUDFLARE_ZONE_API_TOKEN",
}, },
{ {
desc: "missing api key", desc: "missing api key",
envVars: map[string]string{ envVars: map[string]string{
"CLOUDFLARE_EMAIL": "awesome@possum.com", EnvEmail: "awesome@possum.com",
"CLOUDFLARE_API_KEY": "", EnvAPIKey: "",
}, },
expected: "cloudflare: some credentials information are missing: CLOUDFLARE_API_KEY or some credentials information are missing: CLOUDFLARE_DNS_API_TOKEN,CLOUDFLARE_ZONE_API_TOKEN", expected: "cloudflare: some credentials information are missing: CLOUDFLARE_API_KEY or some credentials information are missing: CLOUDFLARE_DNS_API_TOKEN,CLOUDFLARE_ZONE_API_TOKEN",
}, },
@ -110,7 +116,7 @@ func TestNewDNSProviderWithToken(t *testing.T) {
{ {
desc: "same client when zone token is missing", desc: "same client when zone token is missing",
envVars: map[string]string{ envVars: map[string]string{
"CLOUDFLARE_DNS_API_TOKEN": "123", EnvDNSAPIToken: "123",
}, },
expected: expected{ expected: expected{
dnsToken: "123", dnsToken: "123",
@ -121,8 +127,8 @@ func TestNewDNSProviderWithToken(t *testing.T) {
{ {
desc: "same client when zone token equals dns token", desc: "same client when zone token equals dns token",
envVars: map[string]string{ envVars: map[string]string{
"CLOUDFLARE_DNS_API_TOKEN": "123", EnvDNSAPIToken: "123",
"CLOUDFLARE_ZONE_API_TOKEN": "123", EnvZoneAPIToken: "123",
}, },
expected: expected{ expected: expected{
dnsToken: "123", dnsToken: "123",
@ -133,7 +139,7 @@ func TestNewDNSProviderWithToken(t *testing.T) {
{ {
desc: "failure when only zone api given", desc: "failure when only zone api given",
envVars: map[string]string{ envVars: map[string]string{
"CLOUDFLARE_ZONE_API_TOKEN": "123", EnvZoneAPIToken: "123",
}, },
expected: expected{ expected: expected{
error: "cloudflare: some credentials information are missing: CLOUDFLARE_EMAIL,CLOUDFLARE_API_KEY or some credentials information are missing: CLOUDFLARE_DNS_API_TOKEN", error: "cloudflare: some credentials information are missing: CLOUDFLARE_EMAIL,CLOUDFLARE_API_KEY or some credentials information are missing: CLOUDFLARE_DNS_API_TOKEN",
@ -142,8 +148,8 @@ func TestNewDNSProviderWithToken(t *testing.T) {
{ {
desc: "different clients when zone and dns token differ", desc: "different clients when zone and dns token differ",
envVars: map[string]string{ envVars: map[string]string{
"CLOUDFLARE_DNS_API_TOKEN": "123", EnvDNSAPIToken: "123",
"CLOUDFLARE_ZONE_API_TOKEN": "abc", EnvZoneAPIToken: "abc",
}, },
expected: expected{ expected: expected{
dnsToken: "123", dnsToken: "123",
@ -154,10 +160,10 @@ func TestNewDNSProviderWithToken(t *testing.T) {
{ {
desc: "aliases work as expected", // CLOUDFLARE_* takes precedence over CF_* desc: "aliases work as expected", // CLOUDFLARE_* takes precedence over CF_*
envVars: map[string]string{ envVars: map[string]string{
"CLOUDFLARE_DNS_API_TOKEN": "123", EnvDNSAPIToken: "123",
"CF_DNS_API_TOKEN": "456", altEnvName(EnvDNSAPIToken): "456",
"CLOUDFLARE_ZONE_API_TOKEN": "abc", EnvZoneAPIToken: "abc",
"CF_ZONE_API_TOKEN": "def", altEnvName(EnvZoneAPIToken): "def",
}, },
expected: expected{ expected: expected{
dnsToken: "123", dnsToken: "123",
@ -169,9 +175,9 @@ func TestNewDNSProviderWithToken(t *testing.T) {
defer envTest.RestoreEnv() defer envTest.RestoreEnv()
localEnvTest := tester.NewEnvTest( localEnvTest := tester.NewEnvTest(
"CLOUDFLARE_DNS_API_TOKEN", "CF_DNS_API_TOKEN", EnvDNSAPIToken, altEnvName(EnvDNSAPIToken),
"CLOUDFLARE_ZONE_API_TOKEN", "CF_ZONE_API_TOKEN", EnvZoneAPIToken, altEnvName(EnvZoneAPIToken),
).WithDomain("CLOUDFLARE_DOMAIN") ).WithDomain(envDomain)
envTest.ClearEnv() envTest.ClearEnv()
for _, test := range testCases { for _, test := range testCases {

View File

@ -8,6 +8,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/log" "github.com/go-acme/lego/v4/log"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
@ -29,6 +30,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
AuthID string AuthID string

View File

@ -10,6 +10,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/cloudru/internal" "github.com/go-acme/lego/v4/providers/dns/cloudru/internal"
@ -30,6 +31,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
ServiceInstanceID string ServiceInstanceID string

View File

@ -8,6 +8,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/conoha/internal" "github.com/go-acme/lego/v4/providers/dns/conoha/internal"
@ -28,6 +29,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Region string Region string

View File

@ -10,6 +10,7 @@ import (
"strconv" "strconv"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/constellix/internal" "github.com/go-acme/lego/v4/providers/dns/constellix/internal"
@ -29,6 +30,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIKey string APIKey string

View File

@ -7,6 +7,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/corenetworks/internal" "github.com/go-acme/lego/v4/providers/dns/corenetworks/internal"
@ -26,6 +27,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Login string Login string

View File

@ -11,6 +11,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/cpanel/internal/cpanel" "github.com/go-acme/lego/v4/providers/dns/cpanel/internal/cpanel"
@ -33,6 +34,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
type apiClient interface { type apiClient interface {
FetchZoneInformation(ctx context.Context, domain string) ([]shared.ZoneRecord, error) FetchZoneInformation(ctx context.Context, domain string) ([]shared.ZoneRecord, error)
AddRecord(ctx context.Context, serial uint32, domain string, record shared.Record) (*shared.ZoneSerial, error) AddRecord(ctx context.Context, serial uint32, domain string, record shared.Record) (*shared.ZoneSerial, error)

View File

@ -10,6 +10,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/derak/internal" "github.com/go-acme/lego/v4/providers/dns/derak/internal"
@ -29,6 +30,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIKey string APIKey string

View File

@ -9,6 +9,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/nrdcg/desec" "github.com/nrdcg/desec"
@ -30,6 +31,8 @@ const (
// https://desec.readthedocs.io/_/downloads/en/latest/pdf/ // https://desec.readthedocs.io/_/downloads/en/latest/pdf/
const defaultTTL int = 3600 const defaultTTL int = 3600
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Token string Token string

View File

@ -10,6 +10,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/gophercloud/gophercloud" "github.com/gophercloud/gophercloud"
@ -44,6 +45,8 @@ const (
EnvCloud = envNamespaceClient + "CLOUD" EnvCloud = envNamespaceClient + "CLOUD"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
ZoneName string ZoneName string

View File

@ -10,6 +10,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/digitalocean/internal" "github.com/go-acme/lego/v4/providers/dns/digitalocean/internal"
@ -28,6 +29,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
BaseURL string BaseURL string

View File

@ -7,6 +7,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/directadmin/internal" "github.com/go-acme/lego/v4/providers/dns/directadmin/internal"
@ -27,6 +28,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
BaseURL string BaseURL string

View File

@ -9,6 +9,7 @@ import (
"time" "time"
"github.com/dnsimple/dnsimple-go/dnsimple" "github.com/dnsimple/dnsimple-go/dnsimple"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/internal/useragent" "github.com/go-acme/lego/v4/providers/dns/internal/useragent"
@ -28,6 +29,8 @@ const (
EnvPollingInterval = envNamespace + "POLLING_INTERVAL" EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Debug bool Debug bool

View File

@ -11,6 +11,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy/internal" "github.com/go-acme/lego/v4/providers/dns/dnsmadeeasy/internal"
@ -30,6 +31,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
BaseURL string BaseURL string

View File

@ -8,6 +8,7 @@ import (
"strconv" "strconv"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/nrdcg/dnspod-go" "github.com/nrdcg/dnspod-go"
@ -25,6 +26,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
LoginToken string LoginToken string

View File

@ -8,6 +8,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/dode/internal" "github.com/go-acme/lego/v4/providers/dns/dode/internal"
@ -25,6 +26,8 @@ const (
EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL" EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Token string Token string

View File

@ -8,6 +8,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/domeneshop/internal" "github.com/go-acme/lego/v4/providers/dns/domeneshop/internal"
@ -25,6 +26,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIToken string APIToken string

View File

@ -10,6 +10,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/dreamhost/internal" "github.com/go-acme/lego/v4/providers/dns/dreamhost/internal"
@ -26,6 +27,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
BaseURL string BaseURL string

View File

@ -9,6 +9,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/duckdns/internal" "github.com/go-acme/lego/v4/providers/dns/duckdns/internal"
@ -26,6 +27,8 @@ const (
EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL" EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Token string Token string

View File

@ -8,6 +8,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/dyn/internal" "github.com/go-acme/lego/v4/providers/dns/dyn/internal"
@ -27,6 +28,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
CustomerName string CustomerName string

View File

@ -8,6 +8,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/dynu/internal" "github.com/go-acme/lego/v4/providers/dns/dynu/internal"
@ -25,6 +26,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIKey string APIKey string

View File

@ -12,6 +12,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/easydns/internal" "github.com/go-acme/lego/v4/providers/dns/easydns/internal"
@ -32,6 +33,8 @@ const (
EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL" EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Endpoint *url.URL Endpoint *url.URL

View File

@ -10,6 +10,7 @@ import (
configdns "github.com/akamai/AkamaiOPEN-edgegrid-golang/configdns-v2" configdns "github.com/akamai/AkamaiOPEN-edgegrid-golang/configdns-v2"
"github.com/akamai/AkamaiOPEN-edgegrid-golang/edgegrid" "github.com/akamai/AkamaiOPEN-edgegrid-golang/edgegrid"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/log" "github.com/go-acme/lego/v4/log"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
@ -39,6 +40,8 @@ const (
const maxBody = 131072 const maxBody = 131072
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
edgegrid.Config edgegrid.Config

View File

@ -9,6 +9,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/efficientip/internal" "github.com/go-acme/lego/v4/providers/dns/efficientip/internal"
@ -30,6 +31,8 @@ const (
EnvInsecureSkipVerify = envNamespace + "INSECURE_SKIP_VERIFY" EnvInsecureSkipVerify = envNamespace + "INSECURE_SKIP_VERIFY"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Username string Username string

View File

@ -9,6 +9,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/epik/internal" "github.com/go-acme/lego/v4/providers/dns/epik/internal"
@ -26,6 +27,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Signature string Signature string

View File

@ -10,6 +10,7 @@ import (
"os/exec" "os/exec"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/log" "github.com/go-acme/lego/v4/log"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
@ -27,6 +28,8 @@ const (
EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL" EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config Provider configuration. // Config Provider configuration.
type Config struct { type Config struct {
Program string Program string

View File

@ -10,6 +10,7 @@ import (
egoscale "github.com/exoscale/egoscale/v3" egoscale "github.com/exoscale/egoscale/v3"
"github.com/exoscale/egoscale/v3/credentials" "github.com/exoscale/egoscale/v3/credentials"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/internal/useragent" "github.com/go-acme/lego/v4/providers/dns/internal/useragent"
@ -29,6 +30,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIKey string APIKey string

View File

@ -8,6 +8,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/nrdcg/freemyip" "github.com/nrdcg/freemyip"
@ -26,6 +27,8 @@ const (
EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL" EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Token string Token string

View File

@ -9,16 +9,12 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/gandi/internal" "github.com/go-acme/lego/v4/providers/dns/gandi/internal"
) )
// Gandi API reference: http://doc.rpc.gandi.net/index.html
// Gandi API domain examples: http://doc.rpc.gandi.net/domain/faq.html
const minTTL = 300
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "GANDI_" envNamespace = "GANDI_"
@ -31,6 +27,10 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
const minTTL = 300
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
BaseURL string BaseURL string

View File

@ -10,16 +10,13 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/log" "github.com/go-acme/lego/v4/log"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/gandiv5/internal" "github.com/go-acme/lego/v4/providers/dns/gandiv5/internal"
) )
// Gandi API reference: http://doc.livedns.gandi.net/
const minTTL = 300
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "GANDIV5_" envNamespace = "GANDIV5_"
@ -33,6 +30,10 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
const minTTL = 300
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// inProgressInfo contains information about an in-progress challenge. // inProgressInfo contains information about an in-progress challenge.
type inProgressInfo struct { type inProgressInfo struct {
fieldName string fieldName string

View File

@ -11,6 +11,7 @@ import (
"time" "time"
"cloud.google.com/go/compute/metadata" "cloud.google.com/go/compute/metadata"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/log" "github.com/go-acme/lego/v4/log"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
@ -22,10 +23,6 @@ import (
"google.golang.org/api/option" "google.golang.org/api/option"
) )
const (
changeStatusDone = "done"
)
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "GCE_" envNamespace = "GCE_"
@ -41,6 +38,10 @@ const (
EnvPollingInterval = envNamespace + "POLLING_INTERVAL" EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
) )
const changeStatusDone = "done"
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Debug bool Debug bool

View File

@ -8,16 +8,12 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/gcore/internal" "github.com/go-acme/lego/v4/providers/dns/gcore/internal"
) )
const (
defaultPropagationTimeout = 360 * time.Second
defaultPollingInterval = 20 * time.Second
)
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "GCORE_" envNamespace = "GCORE_"
@ -30,6 +26,13 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
const (
defaultPropagationTimeout = 360 * time.Second
defaultPollingInterval = 20 * time.Second
)
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config for DNSProvider. // Config for DNSProvider.
type Config struct { type Config struct {
APIToken string APIToken string

View File

@ -9,13 +9,12 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/glesys/internal" "github.com/go-acme/lego/v4/providers/dns/glesys/internal"
) )
const minTTL = 60
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "GLESYS_" envNamespace = "GLESYS_"
@ -29,6 +28,10 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
const minTTL = 60
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIUser string APIUser string

View File

@ -8,13 +8,12 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/godaddy/internal" "github.com/go-acme/lego/v4/providers/dns/godaddy/internal"
) )
const minTTL = 600
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "GODADDY_" envNamespace = "GODADDY_"
@ -28,6 +27,10 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
const minTTL = 600
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIKey string APIKey string

View File

@ -25,8 +25,7 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
// static compile-time check on interface implementation. var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
var _ challenge.Provider = &DNSProvider{}
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {

View File

@ -8,13 +8,12 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/hetzner/internal" "github.com/go-acme/lego/v4/providers/dns/hetzner/internal"
) )
const minTTL = 60
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "HETZNER_" envNamespace = "HETZNER_"
@ -27,6 +26,10 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
const minTTL = 60
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIKey string APIKey string

View File

@ -9,6 +9,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/internal/hostingde" "github.com/go-acme/lego/v4/providers/dns/internal/hostingde"
@ -27,6 +28,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIKey string APIKey string

View File

@ -10,6 +10,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/hosttech/internal" "github.com/go-acme/lego/v4/providers/dns/hosttech/internal"
@ -27,6 +28,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIKey string APIKey string

View File

@ -10,6 +10,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/internal/hostingde" "github.com/go-acme/lego/v4/providers/dns/internal/hostingde"
@ -28,6 +29,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIKey string APIKey string

View File

@ -11,6 +11,7 @@ import (
"net/url" "net/url"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/internal/errutils" "github.com/go-acme/lego/v4/providers/dns/internal/errutils"
@ -30,6 +31,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
type message struct { type message struct {
FQDN string `json:"fqdn"` FQDN string `json:"fqdn"`
Value string `json:"value"` Value string `json:"value"`

View File

@ -9,6 +9,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/platform/wait" "github.com/go-acme/lego/v4/platform/wait"
@ -33,6 +34,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
AccessKeyID string AccessKeyID string

View File

@ -8,6 +8,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/hurricane/internal" "github.com/go-acme/lego/v4/providers/dns/hurricane/internal"
@ -25,6 +26,8 @@ const (
EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL" EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Credentials map[string]string Credentials map[string]string

View File

@ -9,6 +9,7 @@ import (
"path/filepath" "path/filepath"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/hyperone/internal" "github.com/go-acme/lego/v4/providers/dns/hyperone/internal"
@ -28,6 +29,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIEndpoint string APIEndpoint string

View File

@ -6,6 +6,7 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/ibmcloud/internal" "github.com/go-acme/lego/v4/providers/dns/ibmcloud/internal"
@ -32,6 +33,8 @@ const (
EnvPollingInterval = envNamespace + "POLLING_INTERVAL" EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Username string Username string

View File

@ -9,6 +9,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/iij/doapi" "github.com/iij/doapi"
@ -28,6 +29,8 @@ const (
EnvPollingInterval = envNamespace + "POLLING_INTERVAL" EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
AccessKey string AccessKey string

View File

@ -28,6 +28,8 @@ const (
EnvPollingInterval = envNamespace + "POLLING_INTERVAL" EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Token string Token string
@ -49,8 +51,6 @@ func NewDefaultConfig() *Config {
} }
} }
var _ challenge.Provider = &DNSProvider{}
// DNSProvider implements the challenge.Provider interface. // DNSProvider implements the challenge.Provider interface.
type DNSProvider struct { type DNSProvider struct {
client dpfapi.ClientInterface client dpfapi.ClientInterface

View File

@ -8,6 +8,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/internal/useragent" "github.com/go-acme/lego/v4/providers/dns/internal/useragent"
@ -34,6 +35,8 @@ const (
const defaultPoolConnections = 10 const defaultPoolConnections = 10
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
// Host is the URL of the grid manager. // Host is the URL of the grid manager.

View File

@ -9,6 +9,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/infomaniak/internal" "github.com/go-acme/lego/v4/providers/dns/infomaniak/internal"
@ -30,6 +31,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIEndpoint string APIEndpoint string

View File

@ -8,6 +8,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/internetbs/internal" "github.com/go-acme/lego/v4/providers/dns/internetbs/internal"
@ -26,6 +27,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIKey string APIKey string

View File

@ -6,6 +6,7 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/log" "github.com/go-acme/lego/v4/log"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
@ -27,6 +28,8 @@ const (
EnvPollingInterval = envNamespace + "POLLING_INTERVAL" EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Username string Username string

View File

@ -10,13 +10,12 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/ionos/internal" "github.com/go-acme/lego/v4/providers/dns/ionos/internal"
) )
const minTTL = 300
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "IONOS_" envNamespace = "IONOS_"
@ -29,6 +28,10 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
const minTTL = 300
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIKey string APIKey string

View File

@ -9,6 +9,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/ipv64/internal" "github.com/go-acme/lego/v4/providers/dns/ipv64/internal"
@ -24,9 +25,10 @@ const (
EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT" EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT"
EnvPollingInterval = envNamespace + "POLLING_INTERVAL" EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL" // Deprecated: unused, will be removed in v5.
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIKey string APIKey string

View File

@ -8,6 +8,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/iwantmyname/internal" "github.com/go-acme/lego/v4/providers/dns/iwantmyname/internal"
@ -26,6 +27,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Username string Username string

View File

@ -6,12 +6,15 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/log" "github.com/go-acme/lego/v4/log"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/joker/internal/dmapi" "github.com/go-acme/lego/v4/providers/dns/joker/internal/dmapi"
) )
var _ challenge.ProviderTimeout = (*dmapiProvider)(nil)
// dmapiProvider implements the challenge.Provider interface. // dmapiProvider implements the challenge.Provider interface.
type dmapiProvider struct { type dmapiProvider struct {
config *Config config *Config

View File

@ -6,11 +6,14 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/joker/internal/svc" "github.com/go-acme/lego/v4/providers/dns/joker/internal/svc"
) )
var _ challenge.ProviderTimeout = (*svcProvider)(nil)
// svcProvider implements the challenge.Provider interface. // svcProvider implements the challenge.Provider interface.
type svcProvider struct { type svcProvider struct {
config *Config config *Config

View File

@ -9,6 +9,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/log" "github.com/go-acme/lego/v4/log"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
@ -16,11 +17,6 @@ import (
"github.com/hashicorp/go-retryablehttp" "github.com/hashicorp/go-retryablehttp"
) )
const (
minTTL = 120
maxTTL = 432000
)
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "LIARA_" envNamespace = "LIARA_"
@ -33,6 +29,13 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
const (
minTTL = 120
maxTTL = 432000
)
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIKey string APIKey string

View File

@ -14,14 +14,11 @@ import (
awsconfig "github.com/aws/aws-sdk-go-v2/config" awsconfig "github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/lightsail" "github.com/aws/aws-sdk-go-v2/service/lightsail"
awstypes "github.com/aws/aws-sdk-go-v2/service/lightsail/types" awstypes "github.com/aws/aws-sdk-go-v2/service/lightsail/types"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
) )
const (
maxRetries = 5
)
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "LIGHTSAIL_" envNamespace = "LIGHTSAIL_"
@ -33,6 +30,10 @@ const (
EnvPollingInterval = envNamespace + "POLLING_INTERVAL" EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
) )
const maxRetries = 5
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
DNSZone string DNSZone string

View File

@ -10,6 +10,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/limacity/internal" "github.com/go-acme/lego/v4/providers/dns/limacity/internal"
@ -29,6 +30,8 @@ const (
EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL" EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIKey string APIKey string

View File

@ -9,6 +9,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/internal/useragent" "github.com/go-acme/lego/v4/providers/dns/internal/useragent"
@ -16,12 +17,6 @@ import (
"golang.org/x/oauth2" "golang.org/x/oauth2"
) )
const (
minTTL = 300
dnsUpdateFreqMins = 15
dnsUpdateFudgeSecs = 120
)
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "LINODE_" envNamespace = "LINODE_"
@ -34,6 +29,14 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
const (
minTTL = 300
dnsUpdateFreqMins = 15
dnsUpdateFudgeSecs = 120
)
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Token string Token string

View File

@ -10,14 +10,13 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
lw "github.com/liquidweb/liquidweb-go/client" lw "github.com/liquidweb/liquidweb-go/client"
"github.com/liquidweb/liquidweb-go/network" "github.com/liquidweb/liquidweb-go/network"
) )
const defaultBaseURL = "https://api.liquidweb.com"
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "LIQUID_WEB_" envNamespace = "LIQUID_WEB_"
@ -34,6 +33,10 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
const defaultBaseURL = "https://api.liquidweb.com"
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
BaseURL string BaseURL string

View File

@ -9,13 +9,12 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/loopia/internal" "github.com/go-acme/lego/v4/providers/dns/loopia/internal"
) )
const minTTL = 300
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "LOOPIA_" envNamespace = "LOOPIA_"
@ -30,6 +29,10 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
const minTTL = 300
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
type dnsClient interface { type dnsClient interface {
AddTXTRecord(ctx context.Context, domain string, subdomain string, ttl int, value string) error AddTXTRecord(ctx context.Context, domain string, subdomain string, ttl int, value string) error
RemoveTXTRecord(ctx context.Context, domain string, subdomain string, recordID int) error RemoveTXTRecord(ctx context.Context, domain string, subdomain string, recordID int) error

View File

@ -10,13 +10,12 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/luadns/internal" "github.com/go-acme/lego/v4/providers/dns/luadns/internal"
) )
const minTTL = 300
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "LUADNS_" envNamespace = "LUADNS_"
@ -30,6 +29,10 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
const minTTL = 300
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIUsername string APIUsername string

View File

@ -7,6 +7,7 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/nrdcg/mailinabox" "github.com/nrdcg/mailinabox"
@ -24,6 +25,8 @@ const (
EnvPollingInterval = envNamespace + "POLLING_INTERVAL" EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Email string Email string

View File

@ -8,6 +8,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/nzdjb/go-metaname" "github.com/nzdjb/go-metaname"
@ -25,6 +26,8 @@ const (
EnvPollingInterval = envNamespace + "POLLING_INTERVAL" EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
AccountReference string AccountReference string

View File

@ -8,6 +8,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/mijnhost/internal" "github.com/go-acme/lego/v4/providers/dns/mijnhost/internal"
@ -27,6 +28,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIKey string APIKey string

View File

@ -9,6 +9,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/mittwald/internal" "github.com/go-acme/lego/v4/providers/dns/mittwald/internal"
@ -30,6 +31,8 @@ const (
const minTTL = 300 const minTTL = 300
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Token string Token string

View File

@ -8,6 +8,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/mydnsjp/internal" "github.com/go-acme/lego/v4/providers/dns/mydnsjp/internal"
@ -25,6 +26,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
MasterID string MasterID string

View File

@ -9,6 +9,7 @@ import (
"net/url" "net/url"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/mythicbeasts/internal" "github.com/go-acme/lego/v4/providers/dns/mythicbeasts/internal"
@ -29,6 +30,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
UserName string UserName string

View File

@ -10,6 +10,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/log" "github.com/go-acme/lego/v4/log"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
@ -45,47 +46,7 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
// A challenge represents all the data needed to specify a dns-01 challenge to lets-encrypt. var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
type challenge struct {
domain string
key string
keyFqdn string
keyValue string
tld string
sld string
host string
}
// newChallenge builds a challenge record from a domain name and a challenge authentication key.
func newChallenge(domain, keyAuth string) (*challenge, error) {
domain = dns01.UnFqdn(domain)
tld, _ := publicsuffix.PublicSuffix(domain)
if tld == domain {
return nil, fmt.Errorf("invalid domain name %q", domain)
}
parts := strings.Split(domain, ".")
longest := len(parts) - strings.Count(tld, ".") - 1
sld := parts[longest-1]
var host string
if longest >= 1 {
host = strings.Join(parts[:longest-1], ".")
}
info := dns01.GetChallengeInfo(domain, keyAuth)
return &challenge{
domain: domain,
key: "_acme-challenge." + host,
keyFqdn: info.EffectiveFQDN,
keyValue: info.Value,
tld: tld,
sld: sld,
host: host,
}, nil
}
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
@ -178,22 +139,22 @@ func (d *DNSProvider) Timeout() (timeout, interval time.Duration) {
// Present installs a TXT record for the DNS challenge. // Present installs a TXT record for the DNS challenge.
func (d *DNSProvider) Present(domain, token, keyAuth string) error { func (d *DNSProvider) Present(domain, token, keyAuth string) error {
// TODO(ldez) replace domain by FQDN to follow CNAME. // TODO(ldez) replace domain by FQDN to follow CNAME.
ch, err := newChallenge(domain, keyAuth) pr, err := newPseudoRecord(domain, keyAuth)
if err != nil { if err != nil {
return fmt.Errorf("namecheap: %w", err) return fmt.Errorf("namecheap: %w", err)
} }
ctx := context.Background() ctx := context.Background()
records, err := d.client.GetHosts(ctx, ch.sld, ch.tld) records, err := d.client.GetHosts(ctx, pr.sld, pr.tld)
if err != nil { if err != nil {
return fmt.Errorf("namecheap: %w", err) return fmt.Errorf("namecheap: %w", err)
} }
record := internal.Record{ record := internal.Record{
Name: ch.key, Name: pr.key,
Type: "TXT", Type: "TXT",
Address: ch.keyValue, Address: pr.keyValue,
MXPref: "10", MXPref: "10",
TTL: strconv.Itoa(d.config.TTL), TTL: strconv.Itoa(d.config.TTL),
} }
@ -206,7 +167,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
} }
} }
err = d.client.SetHosts(ctx, ch.sld, ch.tld, records) err = d.client.SetHosts(ctx, pr.sld, pr.tld, records)
if err != nil { if err != nil {
return fmt.Errorf("namecheap: %w", err) return fmt.Errorf("namecheap: %w", err)
} }
@ -216,14 +177,14 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
// CleanUp removes a TXT record used for a previous DNS challenge. // CleanUp removes a TXT record used for a previous DNS challenge.
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error { func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
// TODO(ldez) replace domain by FQDN to follow CNAME. // TODO(ldez) replace domain by FQDN to follow CNAME.
ch, err := newChallenge(domain, keyAuth) pr, err := newPseudoRecord(domain, keyAuth)
if err != nil { if err != nil {
return fmt.Errorf("namecheap: %w", err) return fmt.Errorf("namecheap: %w", err)
} }
ctx := context.Background() ctx := context.Background()
records, err := d.client.GetHosts(ctx, ch.sld, ch.tld) records, err := d.client.GetHosts(ctx, pr.sld, pr.tld)
if err != nil { if err != nil {
return fmt.Errorf("namecheap: %w", err) return fmt.Errorf("namecheap: %w", err)
} }
@ -232,7 +193,7 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
var found bool var found bool
var newRecords []internal.Record var newRecords []internal.Record
for _, h := range records { for _, h := range records {
if h.Name == ch.key && h.Type == "TXT" { if h.Name == pr.key && h.Type == "TXT" {
found = true found = true
} else { } else {
newRecords = append(newRecords, h) newRecords = append(newRecords, h)
@ -243,9 +204,51 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
return nil return nil
} }
err = d.client.SetHosts(ctx, ch.sld, ch.tld, newRecords) err = d.client.SetHosts(ctx, pr.sld, pr.tld, newRecords)
if err != nil { if err != nil {
return fmt.Errorf("namecheap: %w", err) return fmt.Errorf("namecheap: %w", err)
} }
return nil return nil
} }
// A pseudoRecord represents all the data needed to specify a dns-01 challenge to lets-encrypt.
type pseudoRecord struct {
domain string
key string
keyFqdn string
keyValue string
tld string
sld string
host string
}
// newPseudoRecord builds a challenge record from a domain name and a challenge authentication key.
func newPseudoRecord(domain, keyAuth string) (*pseudoRecord, error) {
domain = dns01.UnFqdn(domain)
tld, _ := publicsuffix.PublicSuffix(domain)
if tld == domain {
return nil, fmt.Errorf("invalid domain name %q", domain)
}
parts := strings.Split(domain, ".")
longest := len(parts) - strings.Count(tld, ".") - 1
sld := parts[longest-1]
var host string
if longest >= 1 {
host = strings.Join(parts[:longest-1], ".")
}
info := dns01.GetChallengeInfo(domain, keyAuth)
return &pseudoRecord{
domain: domain,
key: "_acme-challenge." + host,
keyFqdn: info.EffectiveFQDN,
keyValue: info.Value,
tld: tld,
sld: sld,
host: host,
}, nil
}

View File

@ -127,7 +127,7 @@ func mockDNSProvider(t *testing.T, baseURL string) *DNSProvider {
func assertHdr(t *testing.T, tc *testCase, values *url.Values) { func assertHdr(t *testing.T, tc *testCase, values *url.Values) {
t.Helper() t.Helper()
ch, _ := newChallenge(tc.domain, "") ch, _ := newPseudoRecord(tc.domain, "")
assert.Equal(t, envTestUser, values.Get("ApiUser"), "ApiUser") assert.Equal(t, envTestUser, values.Get("ApiUser"), "ApiUser")
assert.Equal(t, envTestKey, values.Get("ApiKey"), "ApiKey") assert.Equal(t, envTestKey, values.Get("ApiKey"), "ApiKey")
assert.Equal(t, envTestUser, values.Get("UserName"), "UserName") assert.Equal(t, envTestUser, values.Get("UserName"), "UserName")
@ -177,7 +177,7 @@ func TestDNSProvider_CleanUp(t *testing.T) {
} }
} }
func TestDomainSplit(t *testing.T) { func Test_newPseudoRecord_domainSplit(t *testing.T) {
tests := []struct { tests := []struct {
domain string domain string
valid bool valid bool
@ -205,7 +205,7 @@ func TestDomainSplit(t *testing.T) {
for _, test := range tests { for _, test := range tests {
t.Run(test.domain, func(t *testing.T) { t.Run(test.domain, func(t *testing.T) {
valid := true valid := true
ch, err := newChallenge(test.domain, "") ch, err := newPseudoRecord(test.domain, "")
if err != nil { if err != nil {
valid = false valid = false
} }

View File

@ -7,14 +7,12 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/namedotcom/go/namecom" "github.com/namedotcom/go/namecom"
) )
// according to https://www.name.com/api-docs/DNS#CreateRecord
const minTTL = 300
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "NAMECOM_" envNamespace = "NAMECOM_"
@ -29,6 +27,11 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
// according to https://www.name.com/api-docs/DNS#CreateRecord
const minTTL = 300
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Username string Username string

View File

@ -6,16 +6,12 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/nrdcg/namesilo" "github.com/nrdcg/namesilo"
) )
const (
defaultTTL = 3600
maxTTL = 2592000
)
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "NAMESILO_" envNamespace = "NAMESILO_"
@ -27,6 +23,13 @@ const (
EnvPollingInterval = envNamespace + "POLLING_INTERVAL" EnvPollingInterval = envNamespace + "POLLING_INTERVAL"
) )
const (
defaultTTL = 3600
maxTTL = 2592000
)
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIKey string APIKey string

View File

@ -8,6 +8,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal" "github.com/go-acme/lego/v4/providers/dns/nearlyfreespeech/internal"
@ -27,6 +28,8 @@ const (
EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL" EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIKey string APIKey string

View File

@ -9,6 +9,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/log" "github.com/go-acme/lego/v4/log"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
@ -29,6 +30,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Key string Key string

View File

@ -10,6 +10,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/netlify/internal" "github.com/go-acme/lego/v4/providers/dns/netlify/internal"
@ -27,6 +28,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Token string Token string

View File

@ -9,6 +9,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/nicmanager/internal" "github.com/go-acme/lego/v4/providers/dns/nicmanager/internal"
@ -33,6 +34,8 @@ const (
const minTTL = 900 const minTTL = 900
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Login string Login string

View File

@ -9,6 +9,7 @@ import (
"net/url" "net/url"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/platform/wait" "github.com/go-acme/lego/v4/platform/wait"
@ -29,6 +30,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
BaseURL string BaseURL string

View File

@ -9,6 +9,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/njalla/internal" "github.com/go-acme/lego/v4/providers/dns/njalla/internal"
@ -27,6 +28,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
Token string Token string

View File

@ -9,6 +9,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/nrdcg/nodion" "github.com/nrdcg/nodion"
@ -26,6 +27,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIToken string APIToken string

View File

@ -7,6 +7,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/log" "github.com/go-acme/lego/v4/log"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
@ -26,6 +27,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
APIKey string APIKey string

View File

@ -8,6 +8,7 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/oracle/oci-go-sdk/v65/common" "github.com/oracle/oci-go-sdk/v65/common"
@ -33,6 +34,8 @@ const (
EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT" EnvHTTPTimeout = envNamespace + "HTTP_TIMEOUT"
) )
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
CompartmentID string CompartmentID string

View File

@ -9,16 +9,12 @@ import (
"net/http" "net/http"
"time" "time"
"github.com/go-acme/lego/v4/challenge"
"github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/challenge/dns01"
"github.com/go-acme/lego/v4/platform/config/env" "github.com/go-acme/lego/v4/platform/config/env"
"github.com/go-acme/lego/v4/providers/dns/otc/internal" "github.com/go-acme/lego/v4/providers/dns/otc/internal"
) )
const defaultIdentityEndpoint = "https://iam.eu-de.otc.t-systems.com:443/v3/auth/tokens"
// minTTL 300 is otc minimum value for TTL.
const minTTL = 300
// Environment variables names. // Environment variables names.
const ( const (
envNamespace = "OTC_" envNamespace = "OTC_"
@ -36,6 +32,13 @@ const (
EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL" EnvSequenceInterval = envNamespace + "SEQUENCE_INTERVAL"
) )
const defaultIdentityEndpoint = "https://iam.eu-de.otc.t-systems.com:443/v3/auth/tokens"
// minTTL 300 is otc minimum value for TTL.
const minTTL = 300
var _ challenge.ProviderTimeout = (*DNSProvider)(nil)
// Config is used to configure the creation of the DNSProvider. // Config is used to configure the creation of the DNSProvider.
type Config struct { type Config struct {
IdentityEndpoint string IdentityEndpoint string

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