MCPcopy Create free account
hub / github.com/foxcpp/maddy / SelectIDNA

Function SelectIDNA

framework/dns/idna.go:31–37  ·  view source on GitHub ↗

SelectIDNA is a convenience function for encoding to/from Punycode. If ulabel is true, it returns U-label encoded domain in the Unicode NFC form. If ulabel is false, it returns A-label encoded domain.

(ulabel bool, domain string)

Source from the content-addressed store, hash-verified

29// form.
30// If ulabel is false, it returns A-label encoded domain.
31func SelectIDNA(ulabel bool, domain string) (string, error) {
32 if ulabel {
33 uDomain, err := idna.ToUnicode(domain)
34 return norm.NFC.String(uDomain), err
35 }
36 return idna.ToASCII(domain)
37}

Callers 2

WriteToMethod · 0.92
WriteToMethod · 0.92

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected