Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Display ¶ added in v4.29.0
Display constructs the string suitable for displaying to the user "example.com" or "punycode.com (unicode.com)" If we add a user-configurable display format, it will be implemented here.
func EfficientToASCII ¶
EfficientToASCII converts a domain name to its ASCII representation using IDNA, on error returns the original name, and avoids allocating new memory when possible. The final string is lowercased.
func EfficientToUnicode ¶
EfficientToUnicode converts a domain name to its Unicode representation using IDNA, on error returns the original name, and avoids allocating new memory when possible.
Types ¶
type DomainNameVarieties ¶
type DomainNameVarieties struct {
NameRaw string // "originalinput.com" (name as input by the user (no tag))
NameASCII string // "punycode.com" (converted to punycode and downcase)
NameUnicode string // "unicode.com" (converted to unicode, ASCII portions downcased)
UniqueName string // "punycode.com!tag" (canonical unique name with tag)
DisplayName string // "canonical" or "canonical (unicode.com)" if unicode
Tag string // The tag portion of `example.com!tag`
HasBang bool // Was there a "!" in the input when creating this struct?
}
DomainNameVarieties stores the various forms of a domain name and tag.
func MakeDomainNameVarieties ¶
func MakeDomainNameVarieties(n string) *DomainNameVarieties
MakeDomainNameVarieties turns the user-supplied name into the varioius forms. * .Tag: the domain tag (of "example.com!tag") * .NameRaw: how the user input the name in dnsconfig.js (no tag) * .NameASCII: punycode version, downcased * .NameUnicode: unicode version of the name, downcased. * .UniqueName: "example.com!tag" unique across the entire config. * .NameDisplay: "punycode.com!tag" or "punycode.com!tag (unicode.com)" if unicode.
type PermitList ¶
type PermitList struct {
// contains filtered or unexported fields
}
PermitList is a structure that holds a pre-compiled version of the --domains commmand line argument. "all" means all domains are permitted and the rest of the list is ignored. Otherwise, the list contains each element stored in a variety of ways useful to the matching algorithm.
func CompilePermitList ¶
func CompilePermitList(s string) PermitList
CompilePermitList compiles a list of domain strings into a PermitList structure. The
func (*PermitList) Permitted ¶
func (pl *PermitList) Permitted(domToCheck string) bool
Permitted returns whether a domain is permitted by the PermitList.