Documentation ¶
Index ¶
- Variables
- type EnvelopeEventsHandler
- type EnvelopeState
- type EnvelopesMonitor
- type Message
- type Option
- type RequestOptions
- type Transport
- func (a *Transport) CleanMessagesProcessed(timestamp uint64) error
- func (a *Transport) ConfirmMessagesProcessed(ids []string, timestamp uint64) error
- func (a *Transport) Filters() []*transport.Filter
- func (a *Transport) GetCurrentTime() uint64
- func (a *Transport) InitCommunityFilters(pks []*ecdsa.PrivateKey) ([]*transport.Filter, error)
- func (a *Transport) InitFilters(chatIDs []string, publicKeys []*ecdsa.PublicKey) ([]*transport.Filter, error)
- func (a *Transport) InitPublicFilters(chatIDs []string) ([]*transport.Filter, error)
- func (a *Transport) JoinGroup(publicKeys []*ecdsa.PublicKey) ([]*transport.Filter, error)
- func (a *Transport) JoinPrivate(publicKey *ecdsa.PublicKey) (*transport.Filter, error)
- func (a *Transport) JoinPublic(chatID string) (*transport.Filter, error)
- func (a *Transport) LeaveGroup(publicKeys []*ecdsa.PublicKey) error
- func (a *Transport) LeavePrivate(publicKey *ecdsa.PublicKey) error
- func (a *Transport) LeavePublic(chatID string) error
- func (a *Transport) LoadFilters(filters []*transport.Filter) ([]*transport.Filter, error)
- func (a *Transport) LoadKeyFilters(key *ecdsa.PrivateKey) (*transport.Filter, error)
- func (a *Transport) MaxMessageSize() uint32
- func (a *Transport) ProcessNegotiatedSecret(secret types.NegotiatedSecret) (*transport.Filter, error)
- func (a *Transport) RemoveFilterByChatID(chatID string) (*transport.Filter, error)
- func (a *Transport) RemoveFilters(filters []*transport.Filter) error
- func (a *Transport) ResetFilters() error
- func (a *Transport) RetrieveAllMessages() ([]Message, error)
- func (a *Transport) RetrievePrivateMessages(publicKey *ecdsa.PublicKey) ([]*types.Message, error)
- func (a *Transport) RetrievePublicMessages(chatID string) ([]*types.Message, error)
- func (a *Transport) RetrieveRawAll() (map[transport.Filter][]*types.Message, error)
- func (a *Transport) SendCommunityMessage(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey) ([]byte, error)
- func (a *Transport) SendMessagesRequest(ctx context.Context, peerID []byte, from, to uint32, previousCursor []byte) (cursor []byte, err error)
- func (a *Transport) SendPrivateOnDiscovery(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey) ([]byte, error)
- func (a *Transport) SendPrivateOnPersonalTopic(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey) ([]byte, error)
- func (a *Transport) SendPrivateWithPartitioned(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey) ([]byte, error)
- func (a *Transport) SendPrivateWithSharedSecret(ctx context.Context, newMessage *types.NewMessage, publicKey *ecdsa.PublicKey, ...) ([]byte, error)
- func (a *Transport) SendPublic(ctx context.Context, newMessage *types.NewMessage, chatName string) ([]byte, error)
- func (a *Transport) SetEnvelopeEventsHandler(handler transport.EnvelopeEventsHandler) error
- func (a *Transport) Stop() error
- func (a *Transport) Track(identifiers [][]byte, hash []byte, newMessage *types.NewMessage)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoMailservers returned if there is no configured mailservers that can be used. ErrNoMailservers = errors.New("no configured mailservers") )
Functions ¶
This section is empty.
Types ¶
type EnvelopeEventsHandler ¶
type EnvelopeEventsHandler interface { EnvelopeSent([][]byte) EnvelopeExpired([][]byte, error) MailServerRequestCompleted(types.Hash, types.Hash, []byte, error) MailServerRequestExpired(types.Hash) }
EnvelopeEventsHandler used for two different event types.
type EnvelopeState ¶
type EnvelopeState int
EnvelopeState in local tracker
const ( // NotRegistered returned if asked hash wasn't registered in the tracker. NotRegistered EnvelopeState = -1 // EnvelopePosted is set when envelope was added to a local whisper queue. EnvelopePosted EnvelopeState = iota // EnvelopeSent is set when envelope is sent to at least one peer. EnvelopeSent )
type EnvelopesMonitor ¶
type EnvelopesMonitor struct {
// contains filtered or unexported fields
}
EnvelopesMonitor is responsible for monitoring whisper envelopes state.
func NewEnvelopesMonitor ¶
func NewEnvelopesMonitor(w types.Whisper, config transport.EnvelopesMonitorConfig) *EnvelopesMonitor
NewEnvelopesMonitor returns a pointer to an instance of the EnvelopesMonitor.
func (*EnvelopesMonitor) Add ¶
func (m *EnvelopesMonitor) Add(identifiers [][]byte, envelopeHash types.Hash, message types.NewMessage)
Add hash to a tracker.
func (*EnvelopesMonitor) GetState ¶
func (m *EnvelopesMonitor) GetState(hash types.Hash) EnvelopeState
type RequestOptions ¶
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport is a transport based on Whisper service.
func NewTransport ¶
func NewTransport( shh types.Whisper, privateKey *ecdsa.PrivateKey, db *sql.DB, mailservers []string, envelopesMonitorConfig *transport.EnvelopesMonitorConfig, logger *zap.Logger, opts ...Option, ) (*Transport, error)
NewTransport returns a new Transport. TODO: leaving a chat should verify that for a given public key
there are no other chats. It may happen that we leave a private chat but still have a public chat for a given public key.
func (*Transport) CleanMessagesProcessed ¶ added in v0.68.6
NOTE: currently not used as whisper is not maintained anymore
func (*Transport) ConfirmMessagesProcessed ¶ added in v0.68.6
NOTE: currently not used as whisper is not maintained anymore
func (*Transport) GetCurrentTime ¶
GetCurrentTime returns the current unix timestamp in milliseconds
func (*Transport) InitCommunityFilters ¶ added in v0.72.0
func (*Transport) InitFilters ¶
func (*Transport) InitPublicFilters ¶ added in v0.67.0
func (*Transport) JoinPrivate ¶
func (*Transport) JoinPublic ¶
func (*Transport) LeavePublic ¶
func (*Transport) LoadFilters ¶
func (*Transport) LoadKeyFilters ¶ added in v0.56.1
func (*Transport) MaxMessageSize ¶ added in v0.63.2
func (*Transport) ProcessNegotiatedSecret ¶
func (*Transport) RemoveFilterByChatID ¶ added in v0.67.0
func (*Transport) RemoveFilters ¶
func (*Transport) ResetFilters ¶
func (*Transport) RetrieveAllMessages ¶
func (*Transport) RetrievePrivateMessages ¶
func (*Transport) RetrievePublicMessages ¶
func (*Transport) RetrieveRawAll ¶
func (*Transport) SendCommunityMessage ¶ added in v0.72.0
func (*Transport) SendMessagesRequest ¶
func (a *Transport) SendMessagesRequest( ctx context.Context, peerID []byte, from, to uint32, previousCursor []byte, ) (cursor []byte, err error)
RequestHistoricMessages requests historic messages for all registered filters.
func (*Transport) SendPrivateOnDiscovery ¶
func (*Transport) SendPrivateOnPersonalTopic ¶ added in v0.69.0
func (*Transport) SendPrivateWithPartitioned ¶
func (*Transport) SendPrivateWithSharedSecret ¶
func (*Transport) SendPublic ¶
func (a *Transport) SendPublic(ctx context.Context, newMessage *types.NewMessage, chatName string) ([]byte, error)
SendPublic sends a new message using the Whisper service. For public filters, chat name is used as an ID as well as a topic.
func (*Transport) SetEnvelopeEventsHandler ¶ added in v0.64.7
func (a *Transport) SetEnvelopeEventsHandler(handler transport.EnvelopeEventsHandler) error