summaryrefslogtreecommitdiff
path: root/vendor/github.com/miekg/dns/defaults.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2023-09-18 13:45:20 +0100
committerLibravatar GitHub <noreply@github.com>2023-09-18 13:45:20 +0100
commitf302ebb8e596f37351332d1e068e10384311ceca (patch)
tree315c4b15ca93432f27c3c1fd6be074310a3943c0 /vendor/github.com/miekg/dns/defaults.go
parent[bugfix] fix flakey paging test (#2210) (diff)
downloadgotosocial-f302ebb8e596f37351332d1e068e10384311ceca.tar.xz
[chore]: Bump github.com/miekg/dns from 1.1.55 to 1.1.56 (#2204)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/miekg/dns/defaults.go')
-rw-r--r--vendor/github.com/miekg/dns/defaults.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/vendor/github.com/miekg/dns/defaults.go b/vendor/github.com/miekg/dns/defaults.go
index c1558b79c..6d7e17605 100644
--- a/vendor/github.com/miekg/dns/defaults.go
+++ b/vendor/github.com/miekg/dns/defaults.go
@@ -5,6 +5,7 @@ import (
"net"
"strconv"
"strings"
+ "unicode"
)
const hexDigit = "0123456789abcdef"
@@ -330,8 +331,18 @@ func Fqdn(s string) string {
// CanonicalName returns the domain name in canonical form. A name in canonical
// form is lowercase and fully qualified. See Section 6.2 in RFC 4034.
+// According to the RFC all uppercase US-ASCII letters in the owner name of the
+// RR areeplaced by the corresponding lowercase US-ASCII letters.
func CanonicalName(s string) string {
- return strings.ToLower(Fqdn(s))
+ var result strings.Builder
+ for _, ch := range s {
+ if unicode.IsUpper(ch) && (ch >= 0x00 && ch <= 0x7F) {
+ result.WriteRune(unicode.ToLower(ch))
+ } else {
+ result.WriteRune(ch)
+ }
+ }
+ return Fqdn(result.String())
}
// Copied from the official Go code.