router

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2018 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

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")

	// ErrNotAuthenticated will be returned by Route method if
	// destination user is not available at this moment.
	ErrNotAuthenticated = errors.New("router: user not authenticated")

	// ErrBlockedJID will be returned by Route method if
	// destination JID matches any of the user's blocked JID.
	ErrBlockedJID = errors.New("router: destination jid is blocked")

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

Functions

func Bind

func Bind(stm stream.C2S)

Bind marks a c2s stream as binded. An error will be returned in case no assigned resource is found.

func Initialize

func Initialize(cfg *Config)

Initialize initializes the router manager.

func IsBlockedJID

func IsBlockedJID(jid *jid.JID, username string) bool

IsBlockedJID returns whether or not the passed jid matches any of a user's blocking list JID.

func MustRoute

func MustRoute(elem xml.Stanza) error

MustRoute routes a stanza applying server rules for handling XML stanzas ignoring blocking lists.

func ReloadBlockList

func ReloadBlockList(username string)

ReloadBlockList reloads in memory block list for a given user and starts applying it for future stanza routing.

func Route

func Route(elem xml.Stanza) error

Route routes a stanza applying server rules for handling XML stanzas. (https://xmpp.org/rfcs/rfc3921.html#rules)

func Shutdown

func Shutdown()

Shutdown shuts down router manager system. This method should be used only for testing purposes.

func Unbind

func Unbind(stm stream.C2S)

Unbind unbinds a previously binded c2s. An error will be returned in case no assigned resource is found.

func UserStreams

func UserStreams(username string) []stream.C2S

UserStreams returns all streams associated to a user.

Types

type Config

type Config struct {

	// GetS2SOut if set, acts as an s2s outgoing stream provider.
	GetS2SOut func(localDomain, remoteDomain string) (stream.S2SOut, error)
}

Config represents router configuration.

Jump to

Keyboard shortcuts

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