2019-03-11 16:56:48 +00:00
|
|
|
package dns01
|
2018-12-06 21:50:17 +00:00
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|