1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

Vet and Lint the entire system (#296)

* govet and golint corrections
This commit is contained in:
Tom Limoncelli
2018-01-09 12:53:16 -05:00
committed by GitHub
parent 1a91a7f536
commit b7c251190f
64 changed files with 540 additions and 433 deletions

View File

@@ -10,6 +10,7 @@ import (
"github.com/pkg/errors"
)
// PtrNameMagic implements the PTR magic.
func PtrNameMagic(name, domain string) (string, error) {
// Implement the PTR name magic. If the name is a properly formed
// IPv4 or IPv6 address, we replace it with the right string (i.e
@@ -20,9 +21,8 @@ func PtrNameMagic(name, domain string) (string, error) {
if strings.HasSuffix(name, ".in-addr.arpa.") || strings.HasSuffix(name, ".ip6.arpa.") {
if strings.HasSuffix(name, "."+domain+".") {
return strings.TrimSuffix(name, "."+domain+"."), nil
} else {
return name, errors.Errorf("PTR record %v in wrong domain (%v)", name, domain)
}
return name, errors.Errorf("PTR record %v in wrong domain (%v)", name, domain)
}
// If the domain is .arpa, we do magic.