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

package pop3

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

Package pop3 implements a minimal POP3 server, mostly intended to be ran over the loopback interface.

Index

Package Files

pop3.go

Variables

var (

    // ErrInUse is the error returned by a Backend if a user's maildrop is
    // already in use by another session.
    ErrInUse = errors.New("[IN-USE] Do you have another POP session running?")

    // ErrBackendFail is the error returned by a Backend if a user's maildrop
    // can't be acquired due to an internal error.
    ErrBackendFail = errors.New("[BACKEND-FAIL] Internal error in backend")
)

type Backend Uses

type Backend interface {
    // NewSession authenticates the user specified by the given username and
    // password, and iff the the credentials are valid, locks the user's
    // maildrop and returns a BackendSession instance.
    NewSession(user, pass []byte) (BackendSession, error)
}

Backend is the common interface exposed by a storage backend.

type BackendSession Uses

type BackendSession interface {
    // Messages returns all of the messages in a user's maildrop.
    Messages() ([][]byte, error)

    // DeleteMessages deletes all of the specified messages, addressed by
    // index into the slice returned by Messages().
    DeleteMessages([]int) error

    // Close unlocks the user's maildrop and tears down the BackendSession.
    Close()
}

BackendSession is a view into a given user's (locked) maildrop.

type Session Uses

type Session struct {
    // contains filtered or unexported fields
}

Session is a POP3 server session.

func NewSession Uses

func NewSession(conn net.Conn, backend Backend) *Session

NewSession creates a new Session, bound to the provided net.Conn, to be serviced via the provided Backend.

func (*Session) Serve Uses

func (s *Session) Serve()

Serve provides POP3 to a Session, via the Backend specified at Session initialization time. The connection will be closed, and the POP3 mailbox unlocked (if required) prior to this routine returning.

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