mailproxy: github.com/katzenpost/mailproxy/internal/imf Index | Files

package imf

import "github.com/katzenpost/mailproxy/internal/imf"

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

Index

Package Files

imf.go report.go

Constants

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"
)

func AddMessageID Uses

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 Uses

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

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

func BytesToEntity Uses

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

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

func EntityToBytes Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

func ValidateHeaders(e *message.Entity) error

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

Package imf imports 13 packages (graph) and is imported by 2 packages. Updated 2018-11-20. Refresh now. Tools for package owners.