func (d *DNSProvider) CleanUp(_, _, _ string) error {
	return nil
}
CleanUp removes the record matching the specified parameters. It is not
implemented for the ACME-DNS provider.
package acmedns
import (
	"errors"
	"fmt"
	"github.com/cpu/goacmedns"
	"github.com/go-acme/lego/v4/challenge/dns01"
	"github.com/go-acme/lego/v4/platform/config/env"
)
const (
	envNamespace = "ACME_DNS_"
	EnvAPIBase = envNamespace + "API_BASE"
	EnvStoragePath = envNamespace + "STORAGE_PATH"
)
type acmeDNSClient interface {
	UpdateTXTRecord(goacmedns.Account, string) error
	RegisterAccount([]string) (goacmedns.Account, error)
}
type DNSProvider struct {
	client  acmeDNSClient
	storage goacmedns.Storage
}
func NewDNSProvider() (*DNSProvider, error) {
	values, err := env.Get(EnvAPIBase, EnvStoragePath)
	if err != nil {
		return nil, fmt.Errorf("acme-dns: %w", err)
	}
	client := goacmedns.NewClient(values[EnvAPIBase])
	storage := goacmedns.NewFileStorage(values[EnvStoragePath], 0o600)
	return NewDNSProviderClient(client, storage)
}
func NewDNSProviderClient(client acmeDNSClient, storage goacmedns.Storage) (*DNSProvider, error) {
	if client == nil {
		return nil, errors.New("ACME-DNS Client must be not nil")
	}
	if storage == nil {
		return nil, errors.New("ACME-DNS Storage must be not nil")
	}
	return &DNSProvider{
		client:  client,
		storage: storage,
	}, nil
}
type ErrCNAMERequired struct {
	Domain string
	FQDN string
	Target string
}
func (e ErrCNAMERequired) Error() string {
	return fmt.Sprintf("acme-dns: new account created for %q. "+
		"To complete setup for %q you must provision the following "+
		"CNAME in your DNS zone and re-run this provider when it is "+
		"in place:\n"+
		"%s CNAME %s.",
		e.Domain, e.Domain, e.FQDN, e.Target)
}
func (d *DNSProvider) Present(domain, _, keyAuth string) error {
	fqdn, value := dns01.GetRecord(domain, keyAuth)
	account, err := d.storage.Fetch(domain)
	if err != nil && !errors.Is(err, goacmedns.ErrDomainNotFound) {
		return err
	}
	if errors.Is(err, goacmedns.ErrDomainNotFound) {
		return d.register(domain, fqdn)
	}
	return d.client.UpdateTXTRecord(account, value)
}