serviceimpl

package
v0.0.0-...-ea65d50 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opts

type Opts struct {
	// The address at which this service publicly reachable. Used by other tasses to forward messages to us for consumption by our clients. Required.
	PublicAddr string
	// Domain for which this tassis registers short numbers
	ChatNumberDomain string
	// The DB to use for storing user device information and keys
	DB db.DB
	// The Broker to use for transmitting user messages between devices
	Broker broker.Broker
	// The Repository to use for advertising and finding user device presence (defaults to a local in-memory implementation)
	PresenceRepo presence.Repository
	// The Forwarder to use for forwarding user messages to other tasses. This should only be used for background tassis processes.
	Forwarder *forwarder.Forwarder
	// A manager for attachments
	AttachmentsManager attachments.Manager
	// How many publishers to cache (can reduce number connect attempts to broker for performance), defaults to 1
	PublisherCacheSize int
	// How frequently to check if a device's one time preKeys are getting low, defaults to 5 minutes
	CheckPreKeysInterval time.Duration
	// How many one time preKeys to consider low enough to warn the client, defaults to 10
	LowPreKeysLimit int
	// How many one time preKeys to request from the client when they get low, defaults to LowPreKeysLimit * 2
	NumPreKeysToRequest int
	// How many parallel routines to run for forwarding messages to other tasses, defaults to 1
	ForwardingParallelism int
	// If a message has been failing to forward for more than ForwardingTimeout, it is permanently discarded. Defaults to 1 hour.
	ForwardingTimeout time.Duration
	// Minimum interval for retrying messages that failed to forward, defaults to ForwardingTimeout / 60.
	MinForwardingRetryInterval time.Duration
	// Determines how frequently to check for users who have transferred and send over their messages. Set to 0 or less to disable. Should only be used in a background tassis process.
	UserTransferInterval time.Duration
}

func (*Opts) ApplyDefaults

func (opts *Opts) ApplyDefaults()

type Service

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

func New

func New(opts *Opts) (*Service, error)

func (*Service) Connect

func (srvc *Service) Connect() (service.ClientConnection, error)

Connect connects a user to the service, returning a ClientConnection with channels for sending messages to the service and receiving messages from it. When the client wishes to disconnect, it should close the ClientConnection.

Until the client sends a Login message, the connection will be unauthenticated and anonymous. An unauthenticated connection can be used only for requesting pre-keys and sending outbound messages with a sealed sender.

A client my log in by sending a login message signed by their public key. Once authenticated, a connection can be used for everything except for sending messages or retrieving pre-keys, which are required to be performed anonymously.

Jump to

Keyboard shortcuts

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