event

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: 4 Imported by: 6

Documentation

Overview

Package event implements the event types returned by the API's event listener.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidReply is the error returned when a SURB reply payload is
	// malformed or otherwise invalid.
	ErrInvalidReply = errors.New("reply body is malformed")

	// ErrSendTimeout is the error returned when a message timed out before
	// being fully sent.
	ErrSendTimeout = errors.New("timed out attempting to send")

	// ErrReplyTimeout is the error returned when a Kaetzchen request timed
	// out waiting for a reply.
	ErrReplyTimeout = errors.New("timed out waiting for reply")
)

Functions

This section is empty.

Types

type ConnectionStatusEvent

type ConnectionStatusEvent struct {
	// AccountID is the account identifier for the account associated with
	// the event.
	AccountID string

	// IsConnected is true iff the account is connected to the provider.
	IsConnected bool

	// Err is the error encountered when connecting or by the connection if any.
	Err error
}

ConnectionStatusEvent is the event sent when an account's connection status changes.

func (*ConnectionStatusEvent) String

func (e *ConnectionStatusEvent) String() string

String returns a string representation of the ConnectionStatusEvent.

type Event

type Event interface {
	// String returns a string representation of the Event.
	String() string
}

Event is the generic event sent over the event listener channel.

type KaetzchenReplyEvent

type KaetzchenReplyEvent struct {
	// AccountID is the account identifier for the account associated with the
	// event.
	AccountID string

	// MessageID is the unique identifier for the request associated with the
	// reply.
	MessageID []byte

	// Payload is the reply payload if any.
	Payload []byte

	// Err is the error encountered when servicing the request if any.
	Err error
}

KaetzchenReplyEvent is the event sent when a Kaetzchen request completes.

func (*KaetzchenReplyEvent) String

func (e *KaetzchenReplyEvent) String() string

String returns a string representation of the KaetzchenReplyEvent.

type MessageReceivedEvent

type MessageReceivedEvent struct {
	// AccountID is the account identifier for the account associated with
	// the event.
	AccountID string

	// SenderKey is the message sender's public key, if any.
	SenderKey *ecdh.PublicKey

	// MessageID is the local unique identifier for the message.
	MessageID []byte
}

MessageReceivedEvent is the event sent when a new message is received.

func (*MessageReceivedEvent) String

func (e *MessageReceivedEvent) String() string

String returns a string representation of the MessageReceivedEvent.

type MessageSentEvent

type MessageSentEvent struct {
	// AccountID is the account identifier for the account associated with
	// the event.
	AccountID string

	// MessageID is the local unique identifier for the message, generated
	// when the message was enqueued.
	MessageID []byte

	// Err is the error encountered when sending the message if any.
	Err error
}

MessageSentEvent is the event sent when a message has been fully transmitted.

func (*MessageSentEvent) String

func (e *MessageSentEvent) String() string

String returns a string representation of a MessageSentEvent.

Jump to

Keyboard shortcuts

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