mailproxy: Index | Files | Directories

package mailproxy

import ""

Package mailproxy implements a POP/SMTP to Katzenpost proxy server.


Package Files

api.go api_kaetzchen.go pop_listener.go proxy.go smtp_listener.go


var (
    // ErrUnknownRecipient is the error that is returned when a recipient for
    // which there is no public key is specified.
    ErrUnknownRecipient = errors.New("mailproxy/api: unknown recipient, missing public key")

    // ErrNoMessages is the error that is returned when an account's receive
    // queue is empty.
    ErrNoMessages = errors.New("mailproxy/api: account receive queue empty")
var (
    // ErrKeyserverSyntaxError is the error returned when the keyserver
    // rejects a query due to a malformed request.
    ErrKeyserverSyntaxError = errors.New("keyserver: syntax error")

    // ErrNoIdentity is the error returned when the keyserver fails to
    // find the requested user, or the user's public key.
    ErrNoIdentity = errors.New("keyserver: user or public key not found")
var ErrGenerateOnly = errors.New("mailproxy: GenerateOnly set")

ErrGenerateOnly is the error returned when the server initialization

type Message Uses

type Message struct {
    // Payload is the Message payload.
    Payload []byte

    // SenderID is the Message sender's identifier set iff the sender is
    // a known recipient.
    SenderID string

    // SenderKey is the Message sender's public key, if any.
    SenderKey *ecdh.PublicKey

    // MessageID is the local unique identifier for the message.
    MessageID []byte

Message is the received message.

type Proxy Uses

type Proxy struct {

    EventSink chan event.Event
    // contains filtered or unexported fields

Proxy is a mail proxy server instance.

func New Uses

func New(cfg *config.Config) (*Proxy, error)

New returns a new Proxy instance parameterized with the specified configuration.

func (*Proxy) GetRecipient Uses

func (p *Proxy) GetRecipient(recipientID string) (*ecdh.PublicKey, error)

GetRecipient returns the public key for the provided recipient.

func (*Proxy) IsConnected Uses

func (p *Proxy) IsConnected(accountID string) bool

IsConnected returns true iff a connection to the provider is established.

func (*Proxy) ListProviders Uses

func (p *Proxy) ListProviders(authorityID string) ([]*pki.MixDescriptor, error)

ListProviders returns a list of Provider identifiers published for the current epoch by the authority identified by authorityID.

func (*Proxy) ListRecipients Uses

func (p *Proxy) ListRecipients() map[string]*ecdh.PublicKey

ListRecipients returns a map of recipientIDs to public keys consisting of all currently known entries. Modifications to the returned map have no effect.

func (*Proxy) ParseKeyQueryResponse Uses

func (p *Proxy) ParseKeyQueryResponse(payload []byte) (string, *ecdh.PublicKey, error)

ParseKeyQueryResponse parses a response obtained from a key server query.

func (*Proxy) QueryKeyFromProvider Uses

func (p *Proxy) QueryKeyFromProvider(senderID, recipientID string) ([]byte, error)

QueryKeyFromProvider enqueues a keyserver lookup from the sender for the specified recipient and returns the message identifier tag.

func (*Proxy) ReceivePeek Uses

func (p *Proxy) ReceivePeek(accountID string) (*Message, error)

ReceivePeek returns the eldest message in the given account's receive queue. The account's receive queue is left intact.

func (*Proxy) ReceivePop Uses

func (p *Proxy) ReceivePop(accountID string) (*Message, error)

ReceivePop removes and returns the eldest message in the given account's receive queue.

func (*Proxy) RemoveRecipient Uses

func (p *Proxy) RemoveRecipient(recipientID string) error

RemoveRecipient removes the provided recipient. This has no impact on messages that have already been enqueued for transmission via SendMessage.

func (*Proxy) ScanRecipientDir Uses

func (p *Proxy) ScanRecipientDir() error

ScanRecipientDir looks for for PEM-encoded identities in the ReceipientDir and imports into the recipient Store.

func (*Proxy) SendKaetzchenRequest Uses

func (p *Proxy) SendKaetzchenRequest(senderID, serviceID, providerID string, payload []byte, wantResponse bool) ([]byte, error)

SendKaetzchenRequest enqueues the payload for transmission from the sender to the service on the remote provider, and returns the message identifier tag.

Note: Replies are delivered as `event.KaetzchenReplyEvent`s, via the EventSink channel. It is on the caller to keep track of requests via the message identifier tag to correctly handle responses.

func (*Proxy) SendMessage Uses

func (p *Proxy) SendMessage(senderID, recipientID string, payload []byte) ([]byte, error)

SendMessage enqueues payload for transmission from the sender to the recipient (account IDs), and returns he message identifier tag. The payload MUST be a well formed IMF message.

Any delivery failures after the message has been successfully enqueued will result in a delivery status notification message being sent from the postmaster to the senderID account.

func (*Proxy) SetRecipient Uses

func (p *Proxy) SetRecipient(recipientID string, publicKey *ecdh.PublicKey) error

SetRecipient sets the public key for the provided recipient.

func (*Proxy) Shutdown Uses

func (p *Proxy) Shutdown()

Shutdown cleanly shuts down a given Proxy instance.

func (*Proxy) Wait Uses

func (p *Proxy) Wait()

Wait waits till the Proxy is terminated for any reason.


configPackage config implements the configuration for the Katzenpost client mail proxy.
eventPackage event implements the event types returned by the API's event listener.
internal/accountPackage account implements the provider account backend.
internal/authorityPackage authority implements the generic PKI backend.
internal/gluePackage glue implements the internal interfaces used to glue the various mailproxy components together.
internal/imfPackage imf implements useful routines for dealing with the Internet Message Format as used by Katzenpost.
internal/pkiclientPackage pkiclient implements a caching wrapper around core/pki.Client.
internal/pop3Package pop3 implements a minimal POP3 server, mostly intended to be ran over the loopback interface.
internal/proxyPackage proxy implements the support for an upstream (outgoing) proxy.
internal/recipientPackage recipient implements the recipient public key store.

Package mailproxy imports 31 packages (graph) and is imported by 6 packages. Updated 2019-11-10. Refresh now. Tools for package owners.