imf

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package imf implements useful routines for dealing with the Internet Message Format as used by Katzenpost.

Index

Constants

View Source
const (
	// SenderIdentityHeader is the mail header containing the Base64
	// representation of the sender's public key, set by the recipient upon
	// successfully receiving a message.
	SenderIdentityHeader = "X-Katzenpost-Sender"

	// UnreliableDeliveryHeader is the mail header signifying that the message
	// should be transmitted without the SURB-ACK functionality.  The expected
	// value is "true" (case insensitive).
	UnreliableDeliveryHeader = "X-Katzenpost-Unreliable"

	// LocalName is the common hostname used by mail proxy instances.
	LocalName = "katzenpost.localhost"
)

Variables

This section is empty.

Functions

func AddMessageID

func AddMessageID(e *message.Entity)

AddMessageID sets the `Message-ID` header if one is not already present in the Entity's header block.

func AddReceived

func AddReceived(e *message.Entity, isMSA bool, viaESMTP bool)

AddReceived prepends a `Received` header entry based on the supplied position and protocol.

func BytesToEntity

func BytesToEntity(b []byte) (*message.Entity, error)

BytesToEntity de-serializes a byte buffer to a message.Entity.

func EntityToBytes

func EntityToBytes(e *message.Entity) ([]byte, error)

EntityToBytes re-serializes a message.Entity into a byte slice suitable for storage or presentation to the user. It assumes that e.Body points to an io.Reader containing the entire flattened body.

Note: Unique message header fields will get reordered due to the backing implementation being a map. This is spec compliant (RFC 5322 3.6), though the RFC strongly recommends against doing so at a `SHOULD NOT` level.

func IsUnreliable

func IsUnreliable(e *message.Entity) (bool, error)

IsUnreliable examines the headers of an IMF message to see if the non-standard UnreliableDeliveryHeader is set.

func KeyLookupSuccess added in v0.0.2

func KeyLookupSuccess(toAddr string, accountID string, identityKey *ecdh.PublicKey) ([]byte, error)

KeyLookupSuccess is used to notify the user that a successful unverified key lookup was completed and that they should verify the key out-of-band.

func NewBounce

func NewBounce(toAddr, recipAddr string, payload []byte) ([]byte, error)

NewBounce creates a new multipart/report message to be used to indicate a failure to deliver a mail.

func NewDecryptionFailure

func NewDecryptionFailure(toAddr string, ciphertext []byte) ([]byte, error)

NewDecryptionFailure creates a new mutipart/report message to be used to indicate a receiver side decryption failure.

func NewEnqueueFailure

func NewEnqueueFailure(toAddr string, enqueued []string, failed map[string]error, header message.Header) ([]byte, error)

NewEnqueueFailure creates a new multipart/report message to be used to indicate one or more failures in enqueueing a mail.

func NewForbiddenHeaders

func NewForbiddenHeaders(toAddr string, sender *ecdh.PublicKey, payload []byte) ([]byte, error)

NewForbiddenHeaders creates a new multipart/report message to be used to indicate a receiver side header validation failure.

func NewMalformedIMF

func NewMalformedIMF(toAddr string, sender *ecdh.PublicKey, payload []byte) ([]byte, error)

NewMalformedIMF creates a new multipart/report message to be used to indicate a receiver side IMF de-serialization failure.

func NewReceiveTimeout

func NewReceiveTimeout(toAddr string, sender *ecdh.PublicKey, blocks map[uint64][]byte, totalBlocks uint64) ([]byte, error)

NewReceiveTimeout creates a new multipart/report message to be used to indicate a failure to receive a mail.

func NewReserializationFailure

func NewReserializationFailure(toAddr string, sender *ecdh.PublicKey, payload []byte) ([]byte, error)

NewReserializationFailure creates a new multipart/report message to be used to indicate a receiver side re-serialization failure.

func ToCRLF

func ToCRLF(b []byte) []byte

ToCRLF attempts to canonicalize the buffer to have the IMF CRLF line endings by converting `\n` octets not immediately preceeded by a `\r` to `\r\n`.

func ValidateHeaders

func ValidateHeaders(e *message.Entity) error

ValidateHeaders sanity checks an IMF message to ensure that none of the proscribed headers are defined.

Types

This section is empty.

Jump to

Keyboard shortcuts

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