Documentation ¶
Index ¶
- func DialFromList(hosts []string, cfg *Config) (*smtp.Client, string)
- func FindServers(domain string) []string
- func InterpretLog(l string, parsed *ParsedMessage)
- func ParseDiskInput(filename string) ([]byte, error)
- func ReadMessage(reader io.Reader) []byte
- func RemoveHeader(msg *[]byte, header string)
- func SanitizeMessage(parsed ParsedMessage, cfg *Config) error
- func SignMessage(parsed ParsedMessage, cfg *Config) error
- func StartTLS(conn *smtp.Client, serverName string, cfg *Config, allowSelfSigned bool) error
- func WriteDiskOutput(filename string, data []byte) error
- type Config
- type ParsedMessage
- func (p ParsedMessage) FileName() string
- func (p ParsedMessage) Hash() string
- func (p ParsedMessage) MarshalText() ([]byte, error)
- func (p *ParsedMessage) RecipientMap() map[string]bool
- func (p *ParsedMessage) Recipients() string
- func (p *ParsedMessage) RemoveRecipients(other string) error
- func (p *ParsedMessage) Save() error
- func (p *ParsedMessage) SetRecipients(recipients string) error
- func (p *ParsedMessage) SetSender(sender string) error
- func (p *ParsedMessage) Unlink() error
- func (p *ParsedMessage) UnmarshalText(b []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DialFromList ¶
DialFromList tries dialing in order a list of IPs as if they are email servers until exhausting possibilities.
func FindServers ¶
FindServers resolves the IP addresses of a given destination `domain`
func InterpretLog ¶
func InterpretLog(l string, parsed *ParsedMessage)
InterpretLog matches the output of a `sendmail` command for a given ParsedMessage. Output lines indicating the message was delivered are used to remove remaining recipients where redelivery is needed.
func ParseDiskInput ¶
ParseDiskInput reads a filename, transforming the data with a configured 'ReadFromDisk' command if set. This allows messages to be passed through a gpg encryption process if desired.
func ReadMessage ¶
ReadMessage scans a given io.Reader into a []byte.
func RemoveHeader ¶
RemoveHeader strips a single header from a byte array representing a full email message.
func SanitizeMessage ¶
func SanitizeMessage(parsed ParsedMessage, cfg *Config) error
SanitizeMessage takes a byte buffer of an Email message, along with configuration for the sending domain, and uses these to transform the message into one that is more privacy preserving - in particular by quantizing identifying dates and message IDs. The byte buffer of the message is modified in-place.
func SignMessage ¶
func SignMessage(parsed ParsedMessage, cfg *Config) error
SignMessage takes a message byte buffer, and adds a DKIM signature to it based on the configuration of the sending domain. the buffer is modified in place.
func WriteDiskOutput ¶
WriteDiskOutput writes a bytestring to a desired file on disk, transforming the data through a configured `WriteToDisk` command if set. This allows messages to be passed through a gpg encryption process if desired.
Types ¶
type Config ¶
type Config struct { DkimKeyCmd string DkimSelector string DialerProxy string SourceHost string TLSCert string TLSKey string SendCommand string // contains filtered or unexported fields }
Config represents the structure of a single domain configuration in config.json
type ParsedMessage ¶
type ParsedMessage struct { Sender string SourceDomain string Rcpt map[string][]string DestDomain []string Bytes *[]byte *mail.Message }
ParsedMessage represents a semi-structred email message.
func ParseMessage ¶
func ParseMessage(msg *[]byte) ParsedMessage
ParseMessage parses a byte array representating an email message to learn the sender, and intended recipients.
func (ParsedMessage) FileName ¶
func (p ParsedMessage) FileName() string
FileName provides a stable location on disk for the message to serialize to.
func (ParsedMessage) Hash ¶
func (p ParsedMessage) Hash() string
Hash provides an ideally stable handle for a message.
func (ParsedMessage) MarshalText ¶
func (p ParsedMessage) MarshalText() ([]byte, error)
MarshalText provides a textual handle of the message. The message contents is not included, and must be saved using `Save` for the marshal'ed handle to be considered durable.
func (*ParsedMessage) RecipientMap ¶
func (p *ParsedMessage) RecipientMap() map[string]bool
RecipientMap returns a map for identification of recipients, where map keys are recipients and map values are `true`.
func (*ParsedMessage) Recipients ¶
func (p *ParsedMessage) Recipients() string
Recipients gets a comma separated list (AddressList) of recipients.
func (*ParsedMessage) RemoveRecipients ¶
func (p *ParsedMessage) RemoveRecipients(other string) error
RemoveRecipients updates the message.Recipients to no longer include a set of addresses specified in AddressList format.
func (*ParsedMessage) Save ¶
func (p *ParsedMessage) Save() error
Save message to disk. TODO: support encryption of on-disk data.
func (*ParsedMessage) SetRecipients ¶
func (p *ParsedMessage) SetRecipients(recipients string) error
SetRecipients sets the accounts and corresponding domains to which the email will be sent.
func (*ParsedMessage) SetSender ¶
func (p *ParsedMessage) SetSender(sender string) error
SetSender specifies an explicit sending email account for the message.
func (*ParsedMessage) Unlink ¶
func (p *ParsedMessage) Unlink() error
Unlink message data from disk if present.
func (*ParsedMessage) UnmarshalText ¶
func (p *ParsedMessage) UnmarshalText(b []byte) error
UnmarshalText attempts to load a message from a textual pointer of its state.