func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
	if config == nil {
		return nil, errors.New("dyn: the configuration of the DNS provider is nil")
	}
	if config.CustomerName == "" || config.UserName == "" || config.Password == "" {
		return nil, errors.New("dyn: credentials missing")
	}
	return &DNSProvider{config: config}, nil
}
NewDNSProviderConfig return a DNSProvider instance configured for Dyn DNS.
package dyn
import (
	"errors"
	"fmt"
	"net/http"
	"strconv"
	"time"
	"github.com/go-acme/lego/v4/challenge/dns01"
	"github.com/go-acme/lego/v4/platform/config/env"
)
const (
	envNamespace = "DYN_"
	EnvCustomerName = envNamespace + "CUSTOMER_NAME"
	EnvUserName     = envNamespace + "USER_NAME"
	EnvPassword     = envNamespace + "PASSWORD"
	EnvTTL                = envNamespace + "TTL"
	EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT"
	EnvPollingInterval    = envNamespace + "POLLING_INTERVAL"
	EnvHTTPTimeout        = envNamespace + "HTTP_TIMEOUT"
)
type Config struct {
	CustomerName       string
	UserName           string
	Password           string
	HTTPClient         *http.Client
	PropagationTimeout time.Duration
	PollingInterval    time.Duration
	TTL                int
}
func NewDefaultConfig() *Config {
	return &Config{
		TTL:                env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL),
		PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, dns01.DefaultPropagationTimeout),
		PollingInterval:    env.GetOrDefaultSecond(EnvPollingInterval, dns01.DefaultPollingInterval),
		HTTPClient: &http.Client{
			Timeout: env.GetOrDefaultSecond(EnvHTTPTimeout, 10*time.Second),
		},
	}
}
type DNSProvider struct {
	config *Config
	token  string
}
func NewDNSProvider() (*DNSProvider, error) {
	values, err := env.Get(EnvCustomerName, EnvUserName, EnvPassword)
	if err != nil {
		return nil, fmt.Errorf("dyn: %w", err)
	}
	config := NewDefaultConfig()
	config.CustomerName = values[EnvCustomerName]
	config.UserName = values[EnvUserName]
	config.Password = values[EnvPassword]
	return NewDNSProviderConfig(config)
}