func (d *DNSProvider) Present(domain, _, keyAuth string) error {
	fqdn, value := dns01.GetRecord(domain, keyAuth)
	ctx := context.Background()
	zone, err := d.guessZone(ctx, fqdn)
	if err != nil {
		return fmt.Errorf("gcore: %w", err)
	}
	err = d.client.AddRRSet(ctx, zone, dns01.UnFqdn(fqdn), value, d.config.TTL)
	if err != nil {
		return fmt.Errorf("gcore: add txt record: %w", err)
	}
	return nil
}
Present creates a TXT record to fulfill the dns-01 challenge.
package gcore
import (
	"context"
	"errors"
	"fmt"
	"net/http"
	"strings"
	"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/gcore/internal"
)
const (
	defaultPropagationTimeout = 360 * time.Second
	defaultPollingInterval    = 20 * time.Second
)
const (
	envNamespace = "GCORE_"
	EnvPermanentAPIToken = envNamespace + "PERMANENT_API_TOKEN"
	EnvTTL                = envNamespace + "TTL"
	EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT"
	EnvPollingInterval    = envNamespace + "POLLING_INTERVAL"
	EnvHTTPTimeout        = envNamespace + "HTTP_TIMEOUT"
)
type Config struct {
	APIToken           string
	PropagationTimeout time.Duration
	PollingInterval    time.Duration
	TTL                int
	HTTPClient         *http.Client
}
func NewDefaultConfig() *Config {
	return &Config{
		TTL:                env.GetOrDefaultInt(EnvTTL, dns01.DefaultTTL),
		PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, defaultPropagationTimeout),
		PollingInterval:    env.GetOrDefaultSecond(EnvPollingInterval, defaultPollingInterval),
		HTTPClient: &http.Client{
			Timeout: env.GetOrDefaultSecond(EnvHTTPTimeout, 10*time.Second),
		},
	}
}
type DNSProvider struct {
	config *Config
	client *internal.Client
}
func NewDNSProvider() (*DNSProvider, error) {
	values, err := env.Get(EnvPermanentAPIToken)
	if err != nil {
		return nil, fmt.Errorf("gcore: %w", err)
	}
	config := NewDefaultConfig()
	config.APIToken = values[EnvPermanentAPIToken]
	return NewDNSProviderConfig(config)
}
func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
	if config == nil {
		return nil, errors.New("gcore: the configuration of the DNS provider is nil")
	}
	if config.APIToken == "" {
		return nil, errors.New("gcore: incomplete credentials provided")
	}
	client := internal.NewClient(config.APIToken)
	if config.HTTPClient != nil {
		client.HTTPClient = config.HTTPClient
	}
	return &DNSProvider{
		config: config,
		client: client,
	}, nil
}