account

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: 35 Imported by: 0

Documentation

Overview

Package account implements the provider account backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	worker.Worker
	sync.Mutex

	InsecureKeyDiscovery bool
	// contains filtered or unexported fields
}

Account is a Provider account and it's associated client instance.

func (*Account) Deref

func (a *Account) Deref()

Deref decrements the reference count of the Account. If the reference count reaches 0, the Account will be torn down and removed from it's associated Store.

func (*Account) EnqueueKaetzchenRequest

func (a *Account) EnqueueKaetzchenRequest(recipient *Recipient, msg []byte, isUnreliable bool) ([]byte, error)

EnqueueKaetzchenRequest enqueues a Katzchen request for transmission.

Note: Kaetzchen requests are treated as "urgent" and will skip to the head of the transmit queue. Additonally, the requests are considered one-shot and not retransmitted.

func (*Account) EnqueueMessage

func (a *Account) EnqueueMessage(recipient *Recipient, msg []byte, isUnreliable bool) ([]byte, error)

EnqueueMessage enqueues a message for transmission.

func (*Account) GetID added in v0.0.2

func (a *Account) GetID() string

GetID returns the Account.id user@provider string

func (*Account) IsConnected

func (a *Account) IsConnected() bool

IsConnected returns true iff the account is connected.

func (*Account) ReceivePeekPop

func (a *Account) ReceivePeekPop(isPop bool) ([]byte, *ecdh.PublicKey, []byte, error)

ReceivePeekPop returns the eldest message in the receive queue, the sender's public key, and a unique identifier, optionally after removing the message from the queue.

func (*Account) StoreReport

func (a *Account) StoreReport(payload []byte) error

StoreReport stores a locally generated report directly in the account's receive spool.

type Recipient

type Recipient struct {
	ID        string
	User      string
	Provider  string
	PublicKey *ecdh.PublicKey
}

Recipient is a outgoing recipient.

type Store

type Store struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Store is a group of Account instances.

func NewStore

func NewStore(g glue.ProxyInternals) *Store

NewStore constructs a new Store instance.

func (*Store) Get

func (s *Store) Get(id string) (*Account, error)

Get returns the Account identified by id, after incrementing the reference count.

func (*Store) NewSession

func (s *Store) NewSession(user, pass []byte) (pop3.BackendSession, error)

NewSession creates a new pop3.BackendSession backed by the specified user, where the user is of the form `user@provider`.

func (*Store) Reset

func (s *Store) Reset()

Reset clears the existing Store instance, terminating clients associated with each account entry.

func (*Store) Set

func (s *Store) Set(id string, cfg *config.Account) error

Set sets the Account identified by id, to a new Account parameterised by the provided config.Account cfg.

Jump to

Keyboard shortcuts

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