rfc5322

package
v0.0.0-...-2b86a76 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package rfc5322 is a parser for RFC 5322 email addresses.

Index

Constants

View Source
const (
	TMailboxList rd.ATag = rd.TLast + iota
	TNameAddr
	TAngleAddr
	TGroup
	TDisplayName
	TAddressList
	TAddrSpec
	TWords
	TAtom
	TDotAtom
	TCText
	TCContents
	TComment
	TQuotedString
	TObsQP
	TObsAngleAddr
	TObsRoute
	TObsDomainList
	TObsMboxList
	TObsAddrList
	TObsGroupList
	TObsLocalPart
	TObsDomain
	TObsMboxTailList
	TObsMboxOptionalList
	TObsAddrTailList
	TObsAddrOptionalList
	TObsDomainTailList
	TObsDomainOptionalList
)

Tags for RFC 5322 parser matches.

Variables

This section is empty.

Functions

func MatchAText

func MatchAText(cs []byte) (*rd.Match, []byte)

MatchAText matches a single atom character.

// atext           =   ALPHA / DIGIT /    ; Printable US-ASCII
//                     "!" / "#" /        ;  characters not including
//                     "\$" / "%" /        ;  specials.  Used for atoms.
//                     "&" / "'" /
//                     "*" / "+" /
//                     "-" / "/" /
//                     "=" / "?" /
//                     "^" / "_" /
//                     "`" / "{" /
//                     "|" / "}" /
//                     "~"

func MatchAddrSpec

func MatchAddrSpec(cs []byte) (*rd.Match, []byte)

MatchAddrSpec matches a bare email address.

// addr-spec       =   local-part "@" domain

func MatchAddress

func MatchAddress(cs []byte) (*rd.Match, []byte)

MatchAddress matches a single mailbox or group.

// address         =   mailbox / group

func MatchAddressList

func MatchAddressList(cs []byte) (*rd.Match, []byte)

MatchAddressList matches one more more addresses, which includes eiether mailboxes or groups, separated by commas.

// address-list    =   (address *("," address)) / obs-addr-list

func MatchAngleAddr

func MatchAngleAddr(cs []byte) (*rd.Match, []byte)

MatchAngleAddr matches a single angle address.

// angle-addr      =   [CFWS] "<" addr-spec ">" [CFWS] /
//                     obs-angle-addr

func MatchAtom

func MatchAtom(cs []byte) (*rd.Match, []byte)

MatchAtom matches a single atom.

// atom            =   [CFWS] 1*atext [CFWS]

func MatchCContent

func MatchCContent(cs []byte) (*rd.Match, []byte)

MatchCContent matches the content inside of a comment.

// ccontent        =   ctext / quoted-pair / comment

func MatchCFWS

func MatchCFWS(cs []byte) (*rd.Match, []byte)

MatchCFWS matches folding whitespace that may contain comments.

// CFWS            =   (1*([FWS] comment) [FWS]) / FWS

func MatchCRLF

func MatchCRLF(cs []byte) (*rd.Match, []byte)

MatchCRLF matches any sensible kind of line ending thing.

// CRLF           = CR LF / CR / LF

func MatchCText

func MatchCText(cs []byte) (*rd.Match, []byte)

MatchCText matches a single character permitted in a comment.

// ctext           =   %d33-39 /          ; Printable US-ASCII
//                     %d42-91 /          ;  characters not including
//                     %d93-126 /         ;  "(", ")", or "\"
//                     obs-ctext

func MatchComment

func MatchComment(cs []byte) (*rd.Match, []byte)

MatchComment matches a email comment.

// comment         =   "(" *([FWS] ccontent) [FWS] ")"

func MatchDText

func MatchDText(cs []byte) (*rd.Match, []byte)

MatchDText matches a single character valid for use in a domain literal.

// dtext           =   %d33-90 /          ; Printable US-ASCII
//                     %d94-126 /         ;  characters not including
//                     obs-dtext          ;  "[", "]", or "\\"

func MatchDisplayName

func MatchDisplayName(cs []byte) (*rd.Match, []byte)

MatchDisplayName matches a display name.

// display-name    =   phrase

func MatchDomain

func MatchDomain(cs []byte) (*rd.Match, []byte)

MatchDomain matches the part of the email after the at-sign.

// domain          =   dot-atom / domain-literal / obs-domain

func MatchDomainLiteral

func MatchDomainLiteral(cs []byte) (*rd.Match, []byte)

MatchDomainLiteral domain literals in email addresses.

// domain-literal  =   [CFWS] "[" *([FWS] dtext) [FWS] "]" [CFWS]

func MatchDotAtom

func MatchDotAtom(cs []byte) (*rd.Match, []byte)

MatchDotAtom matches a complete dot atom list bookended by whitespace and comments.

// dot-atom        =   [CFWS] dot-atom-text [CFWS]

func MatchDotAtomText

func MatchDotAtomText(cs []byte) (*rd.Match, []byte)

MatchDotAtomText matches a list of atoms connected by periods.

// dot-atom-text   =   1*atext *("." 1*atext)

func MatchFWS

func MatchFWS(cs []byte) (*rd.Match, []byte)

MatchFWS matches folding whitespace.

// FWS             =   ([*WSP CRLF] 1*WSP) /  obs-FWS
//                                        ; Folding white space

func MatchGroup

func MatchGroup(cs []byte) (*rd.Match, []byte)

MatchGroup matches a single group address. A group address is a list of mailbox addresses prefixed with a name and ended with a semi-colon.

// group           =   display-name ":" [group-list] ";" [CFWS]

func MatchGroupList

func MatchGroupList(cs []byte) (*rd.Match, []byte)

MatchGroupList matches mailboxes that are permitted within an address group.

// group-list      =   mailbox-list / CFWS / obs-group-list

func MatchLocalPart

func MatchLocalPart(cs []byte) (*rd.Match, []byte)

MatchLocalPart matches the part of the email address before the at-sign.

// local-part      =   dot-atom / quoted-string / obs-local-part

func MatchMailbox

func MatchMailbox(cs []byte) (*rd.Match, []byte)

MatchMailbox matches a single mailbox email address. This is a complete email address with display name or a bare address.

// mailbox         =   name-addr / addr-spec

func MatchMailboxList

func MatchMailboxList(cs []byte) (*rd.Match, []byte)

MatchMailboxList matches one or more mailboxes (groups are not permitted) separated by commas.

// mailbox-list    =   (mailbox *("," mailbox)) / obs-mbox-list

func MatchNameAddr

func MatchNameAddr(cs []byte) (*rd.Match, []byte)

MatchNameAddr matches a single mailbox address, but only those that have a display name followed by angle address.

// name-addr       =   [display-name] angle-addr

func MatchObsAddrList

func MatchObsAddrList(cs []byte) (*rd.Match, []byte)

MatchObsAddrList matches an obsolete list of addresses.

// obs-addr-list   =   *([CFWS] ",") address *("," [address / CFWS])

func MatchObsAngleAddr

func MatchObsAngleAddr(cs []byte) (*rd.Match, []byte)

MatchObsAngleAddr matches an obsolete angle address.

// obs-angle-addr  =   [CFWS] "<" obs-route addr-spec ">" [CFWS]

func MatchObsCText

func MatchObsCText(cs []byte) (*rd.Match, []byte)

MatchObsCText matches a single character for a obsolete comment.

// obs-ctext       =   obs-NO-WS-CTL

func MatchObsDText

func MatchObsDText(cs []byte) (*rd.Match, []byte)

MatchObsDText matches a single obsolete character.

// obs-dtext       =   obs-NO-WS-CTL / quoted-pair

func MatchObsDomain

func MatchObsDomain(cs []byte) (*rd.Match, []byte)

MatchObsDomain matches an obsolete domain part.

// obs-domain      =   atom *("." atom)

func MatchObsDomainList

func MatchObsDomainList(cs []byte) (*rd.Match, []byte)

MatchObsDomainList matches a list of domains for obsolete email addresses.

// obs-domain-list =   *(CFWS / ",") "@" domain
//                     *("," [CFWS] ["@" domain])

func MatchObsFWS

func MatchObsFWS(cs []byte) (*rd.Match, []byte)

MatchObsFWS matches parts of folding whitespace taht is no longer permitted.

// obs-FWS         =   1*WSP *(CRLF 1*WSP)

func MatchObsGroupList

func MatchObsGroupList(cs []byte) (*rd.Match, []byte)

MatchObsGroupList matches obsolete list of mailboxes for use in a group (in this case, allows empty mailboxes lists to match).

// obs-group-list  =   1*([CFWS] ",") [CFWS]

func MatchObsLocalPart

func MatchObsLocalPart(cs []byte) (*rd.Match, []byte)

MatchObsLocalPart matches an obsolete local part.

// obs-local-part  =   word *("." word)

func MatchObsMboxList

func MatchObsMboxList(cs []byte) (*rd.Match, []byte)

MatchObsMboxList matches an obsolete list of mailboxes.

// obs-mbox-list   =   *([CFWS] ",") mailbox *("," [mailbox / CFWS])

func MatchObsNoWSCtl

func MatchObsNoWSCtl(cs []byte) (*rd.Match, []byte)

MatchObsNoWSCtl matches a single character for various obsolete productions.

// obs-NO-WS-CTL   =   %d1-8 /            ; US-ASCII control
//                     %d11 /             ;  characters that do not
//                     %d12 /             ;  include the carriage
//                     %d14-31 /          ;  return, line feed, and
//                     %d127              ;  white space characters

func MatchObsPhrase

func MatchObsPhrase(cs []byte) (*rd.Match, []byte)

MatchObsPhrase matches an obsolete phrase.

// obs-phrase      =   word *(word / "." / CFWS)

func MatchObsQP

func MatchObsQP(cs []byte) (*rd.Match, []byte)

MatchObsQP matches a quoted pair for obsolete matches.

// obs-qp          =   "\\" (%d0 / obs-NO-WS-CTL / LF / CR)

func MatchObsQText

func MatchObsQText(cs []byte) (*rd.Match, []byte)

MatchObsQText matches a single character for obsolete quoted string.

// obs-qtext       =   obs-NO-WS-CTL

func MatchObsRoute

func MatchObsRoute(cs []byte) (*rd.Match, []byte)

MatchObsRoute matches a source route, which is an obsolete email address feature.

// obs-route       =   obs-domain-list ":"

func MatchPhrase

func MatchPhrase(cs []byte) (*rd.Match, []byte)

MatchPhrase matches a list of words.

// phrase          =   1*word / obs-phrase

func MatchQContent

func MatchQContent(cs []byte) (*rd.Match, []byte)

MatchQContent matches the content inside of a quoted string.

// qcontent        =   qtext / quoted-pair

func MatchQText

func MatchQText(cs []byte) (*rd.Match, []byte)

MatchQText matches characters valid within a quoted string.

// qtext           =   %d33 /             ; Printable US-ASCII
//                     %d35-91 /          ;  characters not including
//                     %d93-126 /         ;  "\" or the quote character
//                     obs-qtext

func MatchQuotedPair

func MatchQuotedPair(cs []byte) (*rd.Match, []byte)

MatchQuotedPair matches a quoted pair for use in email addresses.

// quoted-pair     =   ("\\" (VCHAR / WSP)) / obs-qp

func MatchQuotedString

func MatchQuotedString(cs []byte) (*rd.Match, []byte)

MatchQuotedString matches a complete quoted string.

// quoted-string   =   [CFWS]
//                     DQUOTE *([FWS] qcontent) [FWS] DQUOTE
//                     [CFWS]

func MatchWord

func MatchWord(cs []byte) (*rd.Match, []byte)

MatchWord matches a single word or quoted string.

// word            =   atom / quoted-string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL