diff --git a/acme/dns_challenge.go b/acme/dns_challenge.go index 906a219e..83fc45be 100644 --- a/acme/dns_challenge.go +++ b/acme/dns_challenge.go @@ -106,3 +106,21 @@ func checkDNS(domain, fqdn string) bool { return false } + +// toFqdn converts the name into a fqdn appending a trailing dot. +func toFqdn(name string) string { + n := len(name) + if n == 0 || name[n-1] == '.' { + return name + } + return name + "." +} + +// unFqdn converts the fqdn into a name removing the trailing dot. +func unFqdn(name string) string { + n := len(name) + if n != 0 && name[n-1] == '.' { + return name[:n-1] + } + return name +} diff --git a/acme/dns_challenge_cloudflare.go b/acme/dns_challenge_cloudflare.go index 8fbe947a..4781ec5b 100644 --- a/acme/dns_challenge_cloudflare.go +++ b/acme/dns_challenge_cloudflare.go @@ -123,22 +123,6 @@ func newTxtRecord(zoneID, fqdn, value string, ttl int) *cloudflare.Record { } } -func toFqdn(name string) string { - n := len(name) - if n == 0 || name[n-1] == '.' { - return name - } - return name + "." -} - -func unFqdn(name string) string { - n := len(name) - if n != 0 && name[n-1] == '.' { - return name[:n-1] - } - return name -} - // TTL must be between 120 and 86400 seconds func sanitizeTTL(ttl int) int { switch { diff --git a/acme/dns_challenge_dnsimple_test.go b/acme/dns_challenge_dnsimple_test.go index 9dcc8829..0f51afdd 100644 --- a/acme/dns_challenge_dnsimple_test.go +++ b/acme/dns_challenge_dnsimple_test.go @@ -10,9 +10,9 @@ import ( var ( dnsimpleLiveTest bool - dnsimpleEmail string - dnsimpleAPIKey string - dnsimpleDomain string + dnsimpleEmail string + dnsimpleAPIKey string + dnsimpleDomain string ) func init() {