mirror of
https://github.com/go-acme/lego.git
synced 2024-12-26 11:18:00 +02:00
Move toFqdn and unFqdn into a shared place (see GH-84)
This commit is contained in:
parent
08516614dd
commit
d70e2869d2
@ -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
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -10,9 +10,9 @@ import (
|
||||
|
||||
var (
|
||||
dnsimpleLiveTest bool
|
||||
dnsimpleEmail string
|
||||
dnsimpleAPIKey string
|
||||
dnsimpleDomain string
|
||||
dnsimpleEmail string
|
||||
dnsimpleAPIKey string
|
||||
dnsimpleDomain string
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
Loading…
Reference in New Issue
Block a user