router

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CheckUserExistence tells whether to check if the recipient user exists.
	CheckUserExistence = RoutingOptions(1 << 0)
)

Variables

View Source
var (
	// ErrNotExistingAccount will be returned by Route method if destination user does not exist.
	ErrNotExistingAccount = errors.New("router: account does not exist")

	// ErrResourceNotFound will be returned by Route method if destination resource does not match any of user's available resources.
	ErrResourceNotFound = errors.New("router: resource not found")

	// ErrUserNotAvailable will be returned by Route method in case no available resource with non negative priority was found.
	ErrUserNotAvailable = errors.New("router: user not available")

	// ErrRemoteServerNotFound will be returned by Route method if couldn't establish a connection to the remote server.
	ErrRemoteServerNotFound = errors.New("router: remote server not found")

	// ErrRemoteServerTimeout will be returned by Route method if maximum amount of time to establish remote connection
	// was reached.
	ErrRemoteServerTimeout = errors.New("router: remote server timeout")
)

Functions

This section is empty.

Types

type C2SRouter added in v0.10.1

type C2SRouter interface {
	// Route routes a stanza applying server rules for handling XML stanzas.
	// (https://xmpp.org/rfcs/rfc3921.html#rules)
	Route(ctx context.Context, stanza stravaganza.Stanza, routingOpts RoutingOptions) (targets []jid.JID, err error)

	// Disconnect performs disconnection over an available resource.
	Disconnect(ctx context.Context, res *coremodel.Resource, streamErr *streamerror.Error) error

	// Register registers a new stream.
	Register(stm stream.C2S) error

	// Bind sets a previously registered stream as bounded.
	Bind(id stream.C2SID) error

	// Unregister unregisters a stream.
	Unregister(stm stream.C2S) error

	// LocalStream returns local instance stream.
	LocalStream(username, resource string) stream.C2S

	// Start starts C2S router subsystem.
	Start(ctx context.Context) error

	// Stop stops C2S router subsystem.
	Stop(ctx context.Context) error
}

C2SRouter defines C2S router interface.

type Router added in v0.3.4

type Router interface {

	// Route routes a stanza applying server rules for handling XML stanzas.
	// (https://xmpp.org/rfcs/rfc3921.html#rules)
	Route(ctx context.Context, stanza stravaganza.Stanza) (targets []jid.JID, err error)

	// C2SRouter returns the underlying C2S router.
	C2S() C2SRouter

	// S2SRouter returns the underlying S2S router.
	S2S() S2SRouter

	// Start starts global router subsystem.
	Start(ctx context.Context) error

	// Stop stops global router subsystem.
	Stop(ctx context.Context) error
}

Router defines global router interface.

func New added in v0.3.4

func New(hosts *host.Hosts, c2sRouter C2SRouter, s2sRouter S2SRouter) Router

New creates a new router instance given a set of hosts, C2S and S2s routers.

type RoutingOptions added in v0.50.0

type RoutingOptions int8

RoutingOptions represents C2S routing options mask.

type S2SRouter added in v0.10.1

type S2SRouter interface {
	// Route routes a stanza applying server rules for handling XML stanzas.
	// (https://xmpp.org/rfcs/rfc3921.html#rules)
	Route(ctx context.Context, stanza stravaganza.Stanza, senderDomain string) error

	// Start starts S2S router subsystem.
	Start(ctx context.Context) error

	// Stop stops S2S router subsystem.
	Stop(ctx context.Context) error
}

S2SRouter defines S2S router interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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