Documentation ¶
Overview ¶
Package rfc822 implements methods for handling RFC822 messages.
Index ¶
- Variables
- func EraseHeaderValue(literal []byte, key string) ([]byte, error)
- func GetHeaderValue(literal []byte, key string) (string, error)
- func GetMessageHash(b []byte) (string, error)
- func SetHeaderValue(literal []byte, key, val string) ([]byte, error)
- func SetHeaderValueNoMemCopy(literal []byte, key, val string) (io.Reader, int, error)
- func Split(b []byte) ([]byte, []byte)
- type ByteScanner
- type Header
- func (h *Header) Del(key string)
- func (h *Header) Entries(fn func(key, val string))
- func (h *Header) Fields(fields []string) []byte
- func (h *Header) FieldsNot(fields []string) []byte
- func (h *Header) Get(key string) string
- func (h *Header) GetChecked(key string) (string, bool)
- func (h *Header) GetLine(key string) []byte
- func (h *Header) GetRaw(key string) []byte
- func (h *Header) Has(key string) bool
- func (h *Header) Raw() []byte
- func (h *Header) Set(key, val string)
- type MIMEType
- type MultipartWriter
- type Part
- type Section
- func (section *Section) Body() []byte
- func (section *Section) Children() ([]*Section, error)
- func (section *Section) ContentType() (MIMEType, map[string]string, error)
- func (section *Section) DecodedBody() ([]byte, error)
- func (section *Section) Header() []byte
- func (section *Section) Identifier() []int
- func (section *Section) Literal() []byte
- func (section *Section) ParseHeader() (*Header, error)
- func (section *Section) Part(identifier ...int) (*Section, error)
- func (section *Section) Walk(f func(*Section) error) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrNonASCIIHeaderKey = fmt.Errorf("header key contains invalid characters") ErrKeyNotFound = fmt.Errorf("invalid header key") ErrParseHeader = fmt.Errorf("failed to parse header") )
var ErrNoSuchPart = errors.New("no such parts exists")
var ParseMediaType = mime.ParseMediaType
ParseMediaType parses a MIME media type.
Functions ¶
func EraseHeaderValue ¶ added in v0.15.0
EraseHeaderValue removes the header from a literal.
func GetHeaderValue ¶
GetHeaderValue is a helper method that queries a header value in a message literal.
func GetMessageHash ¶ added in v0.17.0
GetMessageHash returns the hash of the given message. This takes into account: - the Subject header, - the From/To/Cc headers, - the Content-Type header of each (leaf) part, - the Content-Disposition header of each (leaf) part, - the (decoded) body of each part.
func SetHeaderValue ¶
SetHeaderValue is a helper method that sets a header value in a message literal. It does not check whether the existing value already exists.
func SetHeaderValueNoMemCopy ¶ added in v0.15.0
SetHeaderValueNoMemCopy is the same as SetHeaderValue, except it does not allocate memory to modify the input literal. Instead, it returns an io.MultiReader that combines the sub-slices in the correct order. This enables us to only allocate memory for the new header field while re-using the old literal.
Types ¶
type ByteScanner ¶ added in v0.12.0
type ByteScanner struct {
// contains filtered or unexported fields
}
func NewByteScanner ¶ added in v0.12.0
func NewByteScanner(data []byte, boundary []byte) (*ByteScanner, error)
func (*ByteScanner) ScanAll ¶ added in v0.12.0
func (s *ByteScanner) ScanAll() []Part
type Header ¶
type Header struct {
// contains filtered or unexported fields
}
func NewEmptyHeader ¶ added in v0.14.0
func NewEmptyHeader() *Header
NewEmptyHeader returns an empty header that can be filled with values.
type MIMEType ¶
type MIMEType string
func ParseMIMEType ¶ added in v0.12.0
func (MIMEType) IsMultiPart ¶ added in v0.12.0
type MultipartWriter ¶
type MultipartWriter struct {
// contains filtered or unexported fields
}
func NewMultipartWriter ¶
func NewMultipartWriter(w io.Writer, boundary string) *MultipartWriter
func (*MultipartWriter) Done ¶
func (w *MultipartWriter) Done() error
type Section ¶
type Section struct {
// contains filtered or unexported fields
}