mailserver

package
v0.23.0-beta.9 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2019 License: MPL-2.0 Imports: 18 Imported by: 10

README

MailServer

This document is meant to collect various information about our MailServer implementation.

Syncing between mail servers

It might happen that one mail server is behind other due to various reasons like a machine being down for a few minutes etc.

There is an option to fix such a mail server:

  1. SSH to a machine where this broken mail server runs,
  2. Add a mail server from which you want to sync:
# sudo might be not needed in your setup
$ echo '{"jsonrpc":"2.0","method":"admin_addPeer", "params": ["enode://c42f368a23fa98ee546fd247220759062323249ef657d26d357a777443aec04db1b29a3a22ef3e7c548e18493ddaf51a31b0aed6079bd6ebe5ae838fcfaf3a49@206.189.243.162:30504"], "id":1}' | \
    sudo socat -d -d - UNIX-CONNECT:/docker/statusd-mail/data/geth.ipc
  1. Mark it as a trusted peer:
# sudo might be not needed in your setup
$ echo '{"jsonrpc":"2.0","method":"shh_markTrustedPeer", "params": ["enode://c42f368a23fa98ee546fd247220759062323249ef657d26d357a777443aec04db1b29a3a22ef3e7c548e18493ddaf51a31b0aed6079bd6ebe5ae838fcfaf3a49@206.189.243.162:30504"], "id":1}' | \
    sudo socat -d -d - UNIX-CONNECT:/docker/statusd-mail/data/geth.ipc
  1. Finally, trigger the sync command:
# sudo might be not needed in your setup
$ echo '{"jsonrpc":"2.0","method":"shhext_syncMessages","params":[{"mailServerPeer":"enode://c42f368a23fa98ee546fd247220759062323249ef657d26d357a777443aec04db1b29a3a22ef3e7c548e18493ddaf51a31b0aed6079bd6ebe5ae838fcfaf3a49@206.189.243.162:30504", "to": 1550479953, "from": 1550393583}],"id":1}' | \
    sudo socat -d -d - UNIX-CONNECT:/docker/statusd-mail/data/geth.ipc
Debugging

To verify that your mail server received any responses, watch logs and seek for logs like this:

INFO [02-18|09:08:54.257] received sync response count=217 final=false err= cursor=[]

And it should finish with:

INFO [02-18|09:08:54.431] received sync response count=0 final=true err= cursor=[]

Documentation

Index

Constants

View Source
const (
	// DBKeyLength is a size of the envelope key.
	DBKeyLength = common.HashLength + timestampLength
)

Variables

View Source
var (
	// ErrInvalidByteSize is returned when DBKey can't be created
	// from a byte slice because it has invalid length.
	ErrInvalidByteSize = errors.New("byte slice has invalid length")
)

Functions

This section is empty.

Types

type DBKey

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

DBKey key to be stored in a db.

func NewDBKey added in v0.35.0

func NewDBKey(timestamp uint32, h common.Hash) *DBKey

NewDBKey creates a new DBKey with the given values.

func NewDBKeyFromBytes

func NewDBKeyFromBytes(b []byte) (*DBKey, error)

NewDBKeyFromBytes creates a DBKey from a byte slice.

func (*DBKey) Bytes added in v0.35.0

func (k *DBKey) Bytes() []byte

Bytes returns a bytes representation of the DBKey.

type MessagesRequestPayload added in v0.35.0

type MessagesRequestPayload struct {
	// Lower is a lower bound of time range for which messages are requested.
	Lower uint32
	// Upper is a lower bound of time range for which messages are requested.
	Upper uint32
	// Bloom is a bloom filter to filter envelopes.
	Bloom []byte
	// Limit is the max number of envelopes to return.
	Limit uint32
	// Cursor is used for pagination of the results.
	Cursor []byte
	// Batch set to true indicates that the client supports batched response.
	Batch bool
}

MessagesRequestPayload is a payload sent to the Mail Server.

type WMailServer

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

WMailServer whisper mailserver.

func (*WMailServer) Archive

func (s *WMailServer) Archive(env *whisper.Envelope)

Archive a whisper envelope.

func (*WMailServer) Close

func (s *WMailServer) Close()

Close the mailserver and its associated db connection.

func (*WMailServer) DeliverMail

func (s *WMailServer) DeliverMail(peer *whisper.Peer, request *whisper.Envelope)

DeliverMail sends mail to specified whisper peer.

func (*WMailServer) Init

func (s *WMailServer) Init(shh *whisper.Whisper, config *params.WhisperConfig) error

Init initializes mailServer.

func (*WMailServer) SyncMail added in v0.35.0

func (s *WMailServer) SyncMail(peer *whisper.Peer, request whisper.SyncMailRequest) error

SyncMail syncs mail servers between two Mail Servers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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