lowercase the names
This commit is contained in:
parent
e4f67647b9
commit
a2d98be202
|
@ -3,6 +3,7 @@ package dns
|
|||
import (
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const hexDigit = "0123456789abcdef"
|
||||
|
@ -215,7 +216,7 @@ func IsDomainName(s string) (uint8, uint8, bool) { // copied from net package.
|
|||
// IsSubDomain checks if child is indeed a child of the parent.
|
||||
func IsSubDomain(parent, child string) bool {
|
||||
// Entire child is contained in parent
|
||||
return CompareLabels(parent, child) == LenLabels(parent)
|
||||
return CompareLabels(strings.ToLower(parent), strings.ToLower(child)) == LenLabels(parent)
|
||||
}
|
||||
|
||||
// IsFqdn checks if a domain name is fully qualified.
|
||||
|
|
|
@ -34,7 +34,8 @@ func SplitLabels(s string) []string {
|
|||
|
||||
// CompareLabels compares the strings s1 and s2 and
|
||||
// returns how many labels they have in common starting from the right.
|
||||
// The comparison stops at the first inequality.
|
||||
// The comparison stops at the first inequality. The labels are not downcased
|
||||
// before the comparison.
|
||||
//
|
||||
// www.miek.nl. and miek.nl. have two labels in common: miek and nl
|
||||
// www.miek.nl. and www.bla.nl. have one label in common: nl
|
||||
|
|
Loading…
Reference in New Issue