mime

package
v0.0.0-...-3f58f9a Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2018 License: MIT Imports: 7 Imported by: 3

Documentation

Overview

Package MIME implemets parsing of MIME and MIME/multipart messages needed to verfiy multipart/signed messages

Index

Constants

This section is empty.

Variables

View Source
var (
	CRLF = []byte("\r\n")
	CR   = []byte("\r")
	LF   = []byte("\n")

	SPACE = []byte(" ")[0]
	HTAB  = []byte("\t")[0]
)

Functions

This section is empty.

Types

type Line

type Line struct {
	Line []byte
	// contains filtered or unexported fields
}

Line of a MIME message

type Lines

type Lines []Line

Multiple lines, needed for body and header

func ParseLines

func ParseLines(raw []byte) (lines Lines)

Parsing linebreaks

func (Lines) Bytes

func (l Lines) Bytes(sep []byte) (raw []byte)

Gives the bytes of the Lines with given linebreak. (e.g. for signed S/MIME use Bytes(mime.CRLF))

type MIME

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

A MIME message

func Parse

func Parse(raw []byte) (m MIME)

Parses a MIME message

func (*MIME) AddHeaderField

func (m *MIME) AddHeaderField(key, value []byte)

Adds a header field to the header of the message

func (*MIME) Body

func (m *MIME) Body() []byte

Gets the body of the message

func (*MIME) DeleteHeaderField

func (m *MIME) DeleteHeaderField(key []byte)

Removes a header fild from the header of the message

func (*MIME) Full

func (m *MIME) Full(sep ...[]byte) []byte

Gets the full message

func (*MIME) FullLines

func (m *MIME) FullLines() (full Lines)

Gets the full message as Lines

func (*MIME) GetHeaderField

func (m *MIME) GetHeaderField(key []byte) (values [][]byte)

Gets the header field with the given key

func (*MIME) Header

func (m *MIME) Header() []byte

Returns the header of the message

func (*MIME) MultipartGetParts

func (m *MIME) MultipartGetParts() (parts []Lines, err error)

Get the parts of a multipart Message

func (*MIME) ParseMediaType

func (m *MIME) ParseMediaType() (mediatype string, params map[string]string, err error)

Parses the mediatype of the message

func (*MIME) SetBody

func (m *MIME) SetBody(body []byte)

Sets the body of the message

func (*MIME) SetHeaderField

func (m *MIME) SetHeaderField(key, value []byte)

Sets the header field with the given key

func (*MIME) SetMultipartBody

func (m *MIME) SetMultipartBody(contentType string, parts ...MIME)

SetMultipartBody makes a mulitpart messages with given parts and contentType

Jump to

Keyboard shortcuts

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