rfc822

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: MIT Imports: 16 Imported by: 17

Documentation

Overview

Package rfc822 implements methods for handling RFC822 messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encrypt added in v0.2.0

func Encrypt(kr *crypto.KeyRing, r io.Reader) ([]byte, error)

func GetHeaderValue

func GetHeaderValue(literal []byte, key string) (string, error)

GetHeaderValue is a helper method that queries a header value in a message literal.

func ParseContentType

func ParseContentType(val string) (string, map[string]string, error)

func SetHeaderValue

func SetHeaderValue(literal []byte, key, val string) ([]byte, error)

SetHeaderValue is a helper method that sets a header value in a message literal.

func Split

func Split(b []byte) ([]byte, []byte, error)

Types

type Header struct {
	// contains filtered or unexported fields
}

func ParseHeader

func ParseHeader(header []byte) *Header

TODO: This is shitty -- should use a real generated parser like the IMAP parser or the RFC5322 parser.

func (*Header) Del

func (h *Header) Del(key string)

func (*Header) Entries

func (h *Header) Entries(fn func(key, val string))

func (*Header) Fields

func (h *Header) Fields(fields []string) []byte

func (*Header) FieldsNot

func (h *Header) FieldsNot(fields []string) []byte

func (*Header) Get

func (h *Header) Get(key string) string

func (*Header) GetLine

func (h *Header) GetLine(key string) []byte

func (*Header) GetRaw

func (h *Header) GetRaw(key string) []byte

func (*Header) Has

func (h *Header) Has(key string) bool

func (*Header) Raw

func (h *Header) Raw() []byte

func (*Header) Set

func (h *Header) Set(key, val string)

TODO: Is it okay to add new entries to the front? Probably not, would break sigs or something.

type MIMEType

type MIMEType string
const (
	TextPlain        MIMEType = "text/plain"
	TextHTML         MIMEType = "text/html"
	MultipartMixed   MIMEType = "multipart/mixed"
	MultipartRelated MIMEType = "multipart/related"
	MessageRFC822    MIMEType = "message/rfc822"
)

type MultipartWriter

type MultipartWriter struct {
	// contains filtered or unexported fields
}

func NewMultipartWriter

func NewMultipartWriter(w io.Writer, boundary string) *MultipartWriter

func (*MultipartWriter) AddPart

func (w *MultipartWriter) AddPart(fn func(io.Writer) error) error

func (*MultipartWriter) Done

func (w *MultipartWriter) Done() error

type Part

type Part struct {
	Data   []byte
	Offset int
}

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

func NewScanner

func NewScanner(r io.Reader, boundary string) (*Scanner, error)

func (*Scanner) ScanAll

func (s *Scanner) ScanAll() ([]Part, error)

type Section

type Section struct {
	// contains filtered or unexported fields
}

func Parse

func Parse(literal []byte) (*Section, error)

func (*Section) Body

func (section *Section) Body() []byte

func (*Section) Children

func (section *Section) Children() []*Section

func (*Section) ContentType

func (section *Section) ContentType() (string, map[string]string, error)

func (*Section) Header

func (section *Section) Header() []byte

func (*Section) Identifier

func (section *Section) Identifier() []int

func (*Section) Literal

func (section *Section) Literal() []byte

func (*Section) ParseHeader

func (section *Section) ParseHeader() *Header

func (*Section) Part

func (section *Section) Part(identifier ...int) *Section

Jump to

Keyboard shortcuts

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