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 ¶
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 c2smodel.ResourceDesc, 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, error)
// 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 ¶
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)
// C2S returns the underlying C2S router.
C2S() C2SRouter
// S2S 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.
type S2SRouter ¶
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.
Click to show internal directories.
Click to hide internal directories.