router

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2019 License: GPL-3.0 Imports: 13 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

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

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

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

type OutS2SProvider interface {
	GetOut(localDomain, remoteDomain string) (stream.S2SOut, error)
}

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 New added in v0.3.4

func New(config *Config) (*Router, error)

New returns an new empty router instance.

func (*Router) Bind added in v0.3.4

func (r *Router) Bind(stm stream.C2S)

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) Cluster added in v0.4.0

func (r *Router) Cluster() Cluster

Cluster returns current router cluster.

func (*Router) ClusterDelegate added in v0.4.0

func (r *Router) ClusterDelegate() cluster.Delegate

ClusterDelegate returns a router cluster delegate interface.

func (*Router) DefaultHostName added in v0.7.0

func (r *Router) DefaultHostName() (hostname string)

DefaultHostName returns default local host name

func (*Router) HostNames added in v0.3.4

func (r *Router) HostNames() []string

HostNames returns the list of all configured host names.

func (*Router) IsBlockedJID added in v0.3.4

func (r *Router) 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 (*Router) IsLocalHost added in v0.3.4

func (r *Router) IsLocalHost(domain string) bool

IsLocalHost returns true if domain is a local server domain.

func (*Router) MustRoute added in v0.3.4

func (r *Router) MustRoute(stanza xmpp.Stanza) error

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

func (*Router) ReloadBlockList added in v0.3.4

func (r *Router) ReloadBlockList(username string)

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

func (r *Router) Route(stanza xmpp.Stanza) error

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

func (r *Router) SetCluster(cluster Cluster)

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

func (r *Router) Unbind(stmJID *jid.JID)

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

func (r *Router) UserStream(j *jid.JID) stream.C2S

UserStreams returns the stream associated to a user jid.

func (*Router) UserStreams added in v0.3.4

func (r *Router) UserStreams(username string) []stream.C2S

UserStreams returns all streams associated to a user.

Jump to

Keyboard shortcuts

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