func NewDNSProvider() (*DNSProvider, error) {
	values, err := env.Get(EnvAPIUsername, EnvAPIToken)
	if err != nil {
		return nil, fmt.Errorf("luadns: %w", err)
	}
	config := NewDefaultConfig()
	config.APIUsername = values[EnvAPIUsername]
	config.APIToken = values[EnvAPIToken]
	return NewDNSProviderConfig(config)
}
NewDNSProvider returns a DNSProvider instance configured for LuaDNS.
Credentials must be passed in the environment variables:
LUADNS_API_USERNAME and LUADNS_API_TOKEN.
package luadns
import (
	"errors"
	"fmt"
	"net/http"
	"strings"
	"sync"
	"time"
	"github.com/go-acme/lego/v4/challenge/dns01"
	"github.com/go-acme/lego/v4/platform/config/env"
	"github.com/go-acme/lego/v4/providers/dns/luadns/internal"
)
const minTTL = 300
const (
	envNamespace = "LUADNS_"
	EnvAPIUsername = envNamespace + "API_USERNAME"
	EnvAPIToken    = envNamespace + "API_TOKEN"
	EnvTTL                = envNamespace + "TTL"
	EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT"
	EnvPollingInterval    = envNamespace + "POLLING_INTERVAL"
	EnvHTTPTimeout        = envNamespace + "HTTP_TIMEOUT"
)
type Config struct {
	APIUsername        string
	APIToken           string
	PropagationTimeout time.Duration
	PollingInterval    time.Duration
	TTL                int
	HTTPClient         *http.Client
}
func NewDefaultConfig() *Config {
	return &Config{
		TTL:                env.GetOrDefaultInt(EnvTTL, minTTL),
		PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, 120*time.Second),
		PollingInterval:    env.GetOrDefaultSecond(EnvPollingInterval, 2*time.Second),
		HTTPClient: &http.Client{
			Timeout: env.GetOrDefaultSecond(EnvHTTPTimeout, 30*time.Second),
		},
	}
}
type DNSProvider struct {
	config *Config
	client *internal.Client
	recordsMu sync.Mutex
	records   map[string]*internal.DNSRecord
}