func (d *DNSProvider) Present(domain, token, keyAuth string) error {
	_, txtRecord := dns01.GetRecord(domain, keyAuth)
	return d.updateTxtRecord(domain, d.config.Token, txtRecord, false)
}
Present creates a TXT record to fulfill the dns-01 challenge.
package duckdns
import (
	"errors"
	"fmt"
	"net/http"
	"time"
	"github.com/go-acme/lego/v4/challenge/dns01"
	"github.com/go-acme/lego/v4/platform/config/env"
)
const (
	envNamespace = "DUCKDNS_"
	EnvToken = envNamespace + "TOKEN"
	EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT"
	EnvPollingInterval    = envNamespace + "POLLING_INTERVAL"
	EnvHTTPTimeout        = envNamespace + "HTTP_TIMEOUT"
	EnvSequenceInterval   = envNamespace + "SEQUENCE_INTERVAL"
)
type Config struct {
	Token              string
	PropagationTimeout time.Duration
	PollingInterval    time.Duration
	SequenceInterval   time.Duration
	HTTPClient         *http.Client
}
func NewDefaultConfig() *Config {
	return &Config{
		PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, dns01.DefaultPropagationTimeout),
		PollingInterval:    env.GetOrDefaultSecond(EnvPollingInterval, dns01.DefaultPollingInterval),
		SequenceInterval:   env.GetOrDefaultSecond(EnvSequenceInterval, dns01.DefaultPropagationTimeout),
		HTTPClient: &http.Client{
			Timeout: env.GetOrDefaultSecond(EnvHTTPTimeout, 30*time.Second),
		},
	}
}
type DNSProvider struct {
	config *Config
}
func NewDNSProvider() (*DNSProvider, error) {
	values, err := env.Get(EnvToken)
	if err != nil {
		return nil, fmt.Errorf("duckdns: %w", err)
	}
	config := NewDefaultConfig()
	config.Token = values[EnvToken]
	return NewDNSProviderConfig(config)
}
func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
	if config == nil {
		return nil, errors.New("duckdns: the configuration of the DNS provider is nil")
	}
	if config.Token == "" {
		return nil, errors.New("duckdns: credentials missing")
	}
	return &DNSProvider{config: config}, nil
}