pop3

package
v0.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2021 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

Types

type Backend

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

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

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

Session is a POP3 server session.

func NewSession

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL