package idna
Import Path
vendor/golang.org/x/net/idna (on golang.org and go.dev)
Dependency Relation
imports 7 packages, and imported by 3 packages
Involved Source Files
d-> idna10.0.0.go
punycode.go
tables12.00.go
trie.go
trieval.go
Exported Type Names
type Option (func)
An Option configures a Profile at creation time.
func BidiRule() Option
func MapForLookup() Option
func RemoveLeadingDots(remove bool) Option
func StrictDomainName(use bool) Option
func Transitional(transitional bool) Option
func ValidateForRegistration() Option
func ValidateLabels(enable bool) Option
func VerifyDNSLength(verify bool) Option
func New(o ...Option) *Profile
type Profile (struct)
A Profile defines the configuration of an IDNA mapper.
(*T) String() string
(*T) ToASCII(s string) (string, error)
(*T) ToUnicode(s string) (string, error)
*T : fmt.Stringer
func New(o ...Option) *Profile
var Display *Profile
var Lookup *Profile
var Punycode *Profile
var Registration *Profile
Exported Values
func BidiRule() Option
BidiRule enables the Bidi rule as defined in RFC 5893. Any application
that relies on proper validation of labels should include this rule.
var Display *Profile
Display is the recommended profile for displaying domain names.
The configuration of this profile may change over time.
var Lookup *Profile
Lookup is the recommended profile for looking up domain names, according
to Section 5 of RFC 5891. The exact configuration of this profile may
change over time.
func MapForLookup() Option
MapForLookup sets validation and mapping options such that a given IDN is
transformed for domain name lookup according to the requirements set out in
Section 5 of RFC 5891. The mappings follow the recommendations of RFC 5894,
RFC 5895 and UTS 46. It does not add the Bidi Rule. Use the BidiRule option
to add this check.
The mappings include normalization and mapping case, width and other
compatibility mappings.
func New(o ...Option) *Profile
New creates a new Profile.
With no options, the returned Profile is the most permissive and equals the
Punycode Profile. Options can be passed to further restrict the Profile. The
MapForLookup and ValidateForRegistration options set a collection of options,
for lookup and registration purposes respectively, which can be tailored by
adding more fine-grained options, where later options override earlier
options.
var Punycode *Profile
Punycode is a Profile that does raw punycode processing with a minimum
of validation.
var Registration *Profile
Registration is the recommended profile for checking whether a given
IDN is valid for registration, according to Section 4 of RFC 5891.
func RemoveLeadingDots(remove bool) Option
RemoveLeadingDots removes leading label separators. Leading runes that map to
dots, such as U+3002 IDEOGRAPHIC FULL STOP, are removed as well.
This is the behavior suggested by the UTS #46 and is adopted by some
browsers.
func StrictDomainName(use bool) Option
StrictDomainName limits the set of permissible ASCII characters to those
allowed in domain names as defined in RFC 1034 (A-Z, a-z, 0-9 and the
hyphen). This is set by default for MapForLookup and ValidateForRegistration.
This option is useful, for instance, for browsers that allow characters
outside this range, for example a '_' (U+005F LOW LINE). See
http://www.rfc-editor.org/std/std3.txt for more details This option
corresponds to the UseSTD3ASCIIRules option in UTS #46.
func Transitional(transitional bool) Option
Transitional sets a Profile to use the Transitional mapping as defined in UTS
#46. This will cause, for example, "ß" to be mapped to "ss". Using the
transitional mapping provides a compromise between IDNA2003 and IDNA2008
compatibility. It is used by most browsers when resolving domain names. This
option is only meaningful if combined with MapForLookup.
const UnicodeVersion = "12.0.0"
UnicodeVersion is the Unicode version from which the tables in this package are derived.
func ValidateForRegistration() Option
ValidateForRegistration sets validation options to verify that a given IDN is
properly formatted for registration as defined by Section 4 of RFC 5891.
func ValidateLabels(enable bool) Option
ValidateLabels sets whether to check the mandatory label validation criteria
as defined in Section 5.4 of RFC 5891. This includes testing for correct use
of hyphens ('-'), normalization, validity of runes, and the context rules.
func VerifyDNSLength(verify bool) Option
VerifyDNSLength sets whether a Profile should fail if any of the IDN parts
are longer than allowed by the RFC.
![]() |
The pages are generated with Golds v0.1.6. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project and developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |