Documentation ¶
Index ¶
- Variables
- type Cluster
- type Config
- type HostConfig
- type OutS2SProvider
- type Router
- func (r *Router) Bind(stm stream.C2S)
- func (r *Router) Certificates() []tls.Certificate
- func (r *Router) Cluster() Cluster
- func (r *Router) ClusterDelegate() cluster.Delegate
- func (r *Router) DefaultHostName() (hostname string)
- func (r *Router) HostNames() []string
- func (r *Router) IsBlockedJID(jid *jid.JID, username string) bool
- func (r *Router) IsLocalHost(domain string) bool
- func (r *Router) MustRoute(stanza xmpp.Stanza) error
- func (r *Router) ReloadBlockList(username string)
- func (r *Router) Route(stanza xmpp.Stanza) error
- func (r *Router) SetCluster(cluster Cluster)
- func (r *Router) SetOutS2SProvider(provider OutS2SProvider)
- func (r *Router) Unbind(stmJID *jid.JID)
- func (r *Router) UserStream(j *jid.JID) stream.C2S
- func (r *Router) UserStreams(username string) []stream.C2S
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 ¶
This section is empty.
Types ¶
type Cluster ¶ added in v0.4.0
type Cluster interface { // LocalNode returns local node name. LocalNode() string C2SStream(jid *jid.JID, presence *xmpp.Presence, context map[string]interface{}, node string) *cluster.C2S SendMessageTo(node string, message *cluster.Message) BroadcastMessage(msg *cluster.Message) }
Cluster represents the generic cluster interface used by router type.
type Config ¶
type Config struct {
Hosts []HostConfig
}
Config represents a router configuration.
func (*Config) UnmarshalYAML ¶ added in v0.4.0
UnmarshalYAML satisfies Unmarshaler interface.
type HostConfig ¶ added in v0.3.4
type HostConfig struct { Name string Certificate tls.Certificate }
HostConfig represents a host specific configuration.
func (*HostConfig) UnmarshalYAML ¶ added in v0.3.4
func (c *HostConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML satisfies Unmarshaler interface.
type OutS2SProvider ¶ added in v0.4.0
OutS2SProvider provides a specific s2s outgoing connection for every single pair of (localdomain, remotedomain) values.
type Router ¶ added in v0.3.4
type Router struct {
// contains filtered or unexported fields
}
Router represents an XMPP stanza router.
func (*Router) Bind ¶ added in v0.3.4
Bind sets a c2s stream as bound. An error will be returned in case no assigned resource is found.
func (*Router) Certificates ¶ added in v0.3.4
func (r *Router) Certificates() []tls.Certificate
Certificates returns an array of all configured domain certificates.
func (*Router) ClusterDelegate ¶ added in v0.4.0
ClusterDelegate returns a router cluster delegate interface.
func (*Router) DefaultHostName ¶ added in v0.7.0
DefaultHostName returns default local host name
func (*Router) IsBlockedJID ¶ added in v0.3.4
IsBlockedJID returns whether or not the passed jid matches any of a user's blocking list jid.
func (*Router) IsLocalHost ¶ added in v0.3.4
IsLocalHost returns true if domain is a local server domain.
func (*Router) MustRoute ¶ added in v0.3.4
MustRoute routes a stanza applying server rules for handling XML stanzas ignoring blocking lists.
func (*Router) ReloadBlockList ¶ added in v0.3.4
ReloadBlockList reloads in memory block list for a given user and starts applying it for future stanza routing.
func (*Router) Route ¶ added in v0.3.4
Route routes a stanza applying server rules for handling XML stanzas. (https://xmpp.org/rfcs/rfc3921.html#rules)
func (*Router) SetCluster ¶ added in v0.4.0
SetCluster sets router cluster interface.
func (*Router) SetOutS2SProvider ¶ added in v0.4.0
func (r *Router) SetOutS2SProvider(provider OutS2SProvider)
SetOutS2SProvider sets the s2s out provider to be used when routing stanzas remotely.
func (*Router) Unbind ¶ added in v0.3.4
Unbind unbinds a previously bound c2s stream. An error will be returned in case no assigned resource is found.
func (*Router) UserStream ¶ added in v0.4.8
UserStreams returns the stream associated to a user jid.