Documentation ¶
Index ¶
- Variables
- func Bind(stm stream.C2S)
- func Initialize(cfg *Config)
- func IsBlockedJID(jid *jid.JID, username string) bool
- func MustRoute(elem xml.Stanza) error
- func ReloadBlockList(username string)
- func Route(elem xml.Stanza) error
- func Shutdown()
- func Unbind(stm stream.C2S)
- func UserStreams(username string) []stream.C2S
- type Config
Constants ¶
This section is empty.
Variables ¶
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 ¶
Bind marks a c2s stream as binded. An error will be returned in case no assigned resource is found.
func IsBlockedJID ¶
IsBlockedJID returns whether or not the passed jid matches any of a user's blocking list JID.
func MustRoute ¶
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 ¶
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 ¶
Unbind unbinds a previously binded c2s. An error will be returned in case no assigned resource is found.
func UserStreams ¶
UserStreams returns all streams associated to a user.