Documentation
¶
Overview ¶
Package mailbox owns bounded parsing of RFC 5322 author address lists for DKIM2 From authenticity (Draft-09 Section 11).
The parser accepts the RFC 5322 address-list grammar with the RFC 6854 group update and the RFC 6532 UTF-8 extensions: display names, comments, folding white space, quoted local parts, obsolete dotted phrases and local parts, and groups. It does not decode encoded words, rewrite bytes, or normalize local parts. Obsolete route syntax inside angle addresses and empty list elements are rejected as unsupported. Callers receive the flattened mailbox count and, for exactly one mailbox, its local part and A-label domain.
Index ¶
Constants ¶
const (
// MaxValueBytes bounds one unfolded author field value.
MaxValueBytes = 16 * 1024
)
Variables ¶
This section is empty.
Functions ¶
func ParseAuthor ¶
ParseAuthor parses one unfolded From field value and classifies it. Only StatusSingle returns a usable Author.
Types ¶
type Author ¶
type Author struct {
// contains filtered or unexported fields
}
Author is the single parsed author mailbox.
type Status ¶
type Status string
Status classifies one author field value.
const ( // StatusSingle reports exactly one mailbox with a DNS domain. StatusSingle Status = "single" // StatusMalformed reports syntax outside the supported grammar. StatusMalformed Status = "malformed" // StatusNoMailbox reports a syntactically valid value without any mailbox, // such as an empty group. StatusNoMailbox Status = "no_mailbox" // StatusMultiple reports more than one mailbox after flattening groups. StatusMultiple Status = "multiple" // StatusDomainLiteral reports a single mailbox whose domain is a literal. StatusDomainLiteral Status = "domain_literal" // StatusInvalidDomain reports a single mailbox whose domain is not a valid // IDNA2008 DNS name. StatusInvalidDomain Status = "invalid_domain" )