pop3

package
v0.0.0-...-7dc0240 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteSession

func DeleteSession(user string)

Types

type Authorizator

type Authorizator struct {
}

Authorizator is a authorizator interface implementation

func (Authorizator) Authorize

func (a Authorizator) Authorize(user, pass string) bool

Authorize user for given username and password.

type Backend

type Backend struct{}

Backend is a backend interface implementation

func NewBackend

func NewBackend() *Backend

func (*Backend) ClearLocks

func (b *Backend) ClearLocks() error

ClearLocks deletes all stuck lock files in all users mail directories. It's caled at pop3 server start only.

func (*Backend) Dele

func (b *Backend) Dele(user string, msgId int) error

Delete message by message ID - message should be just marked as deleted until Update() is called. Be aware that after Dele() is called, functions like List() etc. should ignore all these messages even if Update() hasn't been called yet

func (*Backend) List

func (b *Backend) List(user string) (octets []int, err error)

List of sizes of all messages in bytes (octets)

func (*Backend) ListMessage

func (b *Backend) ListMessage(user string, msgId int) (exists bool, octets int, err error)

Returns whether message exists and if yes, then return size of the message in bytes (octets)

func (*Backend) Lock

func (b *Backend) Lock(user string) (inUse bool, err error)

Lock is called immediately after client is connected. The best way what to use Lock() for is to read all the messages into cache after client is connected. If another user tries to lock the storage, you should return an error to avoid data race.

func (*Backend) Log

func (b *Backend) Log(s string, loglevel int)

Log should implement any backend specific logging

func (*Backend) Retr

func (b *Backend) Retr(user string, msgId int) (message string, err error)

Retrieve whole message by ID - note that message ID is a message position returned by List() function, so be sure to keep that order unchanged while client is connected See Lock() function for more details

func (*Backend) Rset

func (b *Backend) Rset(user string) error

Undelete all messages marked as deleted in single connection

func (*Backend) Stat

func (b *Backend) Stat(user string) (messages, octets int, err error)

Returns total message count and total mailbox size in bytes (octets). Deleted messages are ignored.

func (*Backend) TopMessage

func (b *Backend) TopMessage(user string, msgId, msgLines int) (exists bool, message string, err error)

Similar to TopMessage, but returns unique ID by message ID instead of size.

func (*Backend) Uidl

func (b *Backend) Uidl(user string) (uids []string, err error)

List of unique IDs of all message, similar to List(), but instead of size there is a unique ID which persists the same across all connections. Uid (unique id) is used to allow client to be able to keep messages on the server.

func (*Backend) UidlMessage

func (b *Backend) UidlMessage(user string, msgId int) (exists bool, uid string, err error)

Similar to ListMessage, but returns unique ID by message ID instead of size.

func (*Backend) Unlock

func (b *Backend) Unlock(user string) error

Release lock on storage, Unlock() is called after client is disconnected.

func (*Backend) Update

func (b *Backend) Update(user string) error

Write all changes to persistent storage, i.e. delete all messages marked as deleted.

type Message

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

func NewMessage

func NewMessage(filename, key string, size int) *Message

type Pop3d

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

pop3 Server

func NewPop3d

func NewPop3d(d core.Dsn) *Pop3d

NewPop3d returns a new SmtpServer

func (*Pop3d) ListenAndServe

func (p *Pop3d) ListenAndServe()

ListenAndServe launches pop3 server

type Session

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

func GetSession

func GetSession(user string) (session *Session, err error)

func NewSession

func NewSession(user string, s *Session) *Session

Jump to

Keyboard shortcuts

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