Documentation ¶
Overview ¶
Package imf implements useful routines for dealing with the Internet Message Format as used by Katzenpost.
Index ¶
- Constants
- func AddMessageID(e *message.Entity)
- func AddReceived(e *message.Entity, isMSA bool, viaESMTP bool)
- func BytesToEntity(b []byte) (*message.Entity, error)
- func EntityToBytes(e *message.Entity) ([]byte, error)
- func IsUnreliable(e *message.Entity) (bool, error)
- func NewBounce(toAddr, recipAddr string, payload []byte) ([]byte, error)
- func NewDecryptionFailure(toAddr string, ciphertext []byte) ([]byte, error)
- func NewEnqueueFailure(toAddr string, enqueued []string, failed map[string]error, ...) ([]byte, error)
- func NewForbiddenHeaders(toAddr string, sender *ecdh.PublicKey, payload []byte) ([]byte, error)
- func NewMalformedIMF(toAddr string, sender *ecdh.PublicKey, payload []byte) ([]byte, error)
- func NewReceiveTimeout(toAddr string, sender *ecdh.PublicKey, blocks map[uint64][]byte, ...) ([]byte, error)
- func NewReserializationFailure(toAddr string, sender *ecdh.PublicKey, payload []byte) ([]byte, error)
- func ToCRLF(b []byte) []byte
- func ValidateHeaders(e *message.Entity) error
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" )
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 ¶
AddReceived prepends a `Received` header entry based on the supplied position and protocol.
func BytesToEntity ¶
BytesToEntity de-serializes a byte buffer to a message.Entity.
func EntityToBytes ¶
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 ¶
IsUnreliable examines the headers of an IMF message to see if the non-standard UnreliableDeliveryHeader is set.
func NewBounce ¶
NewBounce creates a new multipart/report message to be used to indicate a failure to deliver a mail.
func NewDecryptionFailure ¶
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 ¶
NewForbiddenHeaders creates a new multipart/report message to be used to indicate a receiver side header validation failure.
func NewMalformedIMF ¶
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 ¶
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.