Use strings.HasSuffix for IsFqdn (#874)
This commit is contained in:
parent
b0835fab5e
commit
5913ad55e9
|
@ -4,6 +4,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const hexDigit = "0123456789abcdef"
|
const hexDigit = "0123456789abcdef"
|
||||||
|
@ -191,11 +192,7 @@ func IsMsg(buf []byte) error {
|
||||||
|
|
||||||
// IsFqdn checks if a domain name is fully qualified.
|
// IsFqdn checks if a domain name is fully qualified.
|
||||||
func IsFqdn(s string) bool {
|
func IsFqdn(s string) bool {
|
||||||
l := len(s)
|
return strings.HasSuffix(s, ".")
|
||||||
if l == 0 {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return s[l-1] == '.'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsRRset checks if a set of RRs is a valid RRset as defined by RFC 2181.
|
// IsRRset checks if a set of RRs is a valid RRset as defined by RFC 2181.
|
||||||
|
|
Loading…
Reference in New Issue