{"modulePath":"github.com/foxcpp/maddy","version":"v0.9.8","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package address\n\nPackage address provides utilities for parsing and validation of RFC 2821 addresses.\n\n## Variables\n\n```go\nvar ErrUnicodeMailbox = errors.New(\"address: cannot convert the Unicode local-part to the ACE form\")\n```\n\n## Functions\n\n```go\nfunc CleanDomain(addr string) (string, error)\n```\nCleanDomain returns the address with the domain part converted into its canonical form.\n\nMore specifically, converts the domain part of the address to U-labels, normalizes it to NFC and then case-folds it.\n\nOriginal value is also returned on the error.\n\n```go\nfunc Equal(addr1, addr2 string) bool\n```\nEqual reports whether addr1 and addr2 are considered to be case-insensitively equivalent.\n\nThe equivalence is defined to be the conjunction of IDN label equivalence for the domain part and canonical equivalence\\* of the local-part converted to lower case.\n\n\\* IDN label equivalence is defined by RFC 5890 Section 2.3.2.4. \\*\\* Canonical equivalence is defined by UAX #15.\n\nEquivalence for malformed addresses is defined using regular byte-string comparison with case-folding applied.\n\n```go\nfunc FQDNDomain(addr string) string\n```\n\n```go\nfunc ForLookup(addr string) (string, error)\n```\nForLookup transforms the local-part of the address into a canonical form usable for map lookups or direct comparisons.\n\nIf Equal(addr1, addr2) == true, then ForLookup(addr1) == ForLookup(addr2).\n\nOn error, case-folded addr is also returned.\n\n```go\nfunc IsASCII(s string) bool\n```\n\n```go\nfunc PRECIS(addr string) (string, error)\n```\nPRECIS applies UsernameCasePreserved to the local part and dns.ForLookup to domain part of the address.\n\n```go\nfunc PRECISFold(addr string) (string, error)\n```\nPRECISFold applies UsernameCaseMapped to the local part and dns.ForLookup to domain part of the address.\n\n```go\nfunc ParseList(list string) ([]*mail.Address, error)\n```\nParseList parses a comma-separated list of RFC 5322 addresses, decoding encoded display names using the charsets supported by go-message.\n\n```go\nfunc QuoteMbox(mbox string) string\n```\n\n```go\nfunc SelectIDNA(ulabel bool, addr string) (string, error)\n```\nSelectIDNA is a convenience function for conversion of domains in the email addresses to/from the Punycode form.\n\nulabel=true =\u003e ToUnicode is used. ulabel=false =\u003e ToASCII is used.\n\n```go\nfunc Split(addr string) (mailbox, domain string, err error)\n```\nSplit splits a email address (as defined by RFC 5321 as a forward-path token) into local part (mailbox) and domain.\n\nNote that definition of the forward-path token includes the special postmaster address without the domain part. Split will return domain == \"\" in this case.\n\nSplit does almost no sanity checks on the input and is intentionally naive. If this is a concern, ValidMailbox and ValidDomain should be used on the output.\n\n```go\nfunc ToASCII(addr string) (string, error)\n```\nToASCII converts the domain part of the email address to the A-label form and fails with ErrUnicodeMailbox if the local-part contains non-ASCII characters.\n\n```go\nfunc ToUnicode(addr string) (string, error)\n```\nToUnicode converts the domain part of the email address to the U-label form.\n\n```go\nfunc UnquoteMbox(mbox string) (string, error)\n```\nUnquoteMbox undoes escaping and quoting of the local-part.  That is, for local-part \\`\"test\\\\\" @ test\"\\` it will return \\`test\" @test\\`.\n\n```go\nfunc Valid(addr string) bool\n```\nValid checks whether ths string is valid as a email address as defined by RFC 5321.\n\n```go\nfunc ValidDomain(domain string) bool\n```\nValidDomain checks whether the specified string is a valid DNS domain.\n\n```go\nfunc ValidMailboxName(mbox string) bool\n```\nValidMailboxName checks whether the specified string is a valid mailbox-name element of e-mail address (left part of it, before at-sign).\n\n","path":"github.com/foxcpp/maddy/framework/address","name":"address","synopsis":"Package address provides utilities for parsing and validation of RFC 2821 addresses.","isRedistributable":true}
