router

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2018 License: GPL-3.0 Imports: 9 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 Config

type Config struct {
	Hosts []HostConfig `yaml:"hosts"`
}

type HostConfig added in v0.3.4

type HostConfig struct {
	Name        string
	Certificate tls.Certificate
}

func (*HostConfig) UnmarshalYAML added in v0.3.4

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

UnmarshalYAML satisfies Unmarshaler interface.

type Router added in v0.3.4

type Router struct {
	// contains filtered or unexported fields
}

func New added in v0.3.4

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

func (*Router) Bind added in v0.3.4

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

Bind marks a c2s stream as binded. 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

func (*Router) HostNames added in v0.3.4

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

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

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

func (r *Router) SetS2SOutProvider(s2sOutProvider S2SOutProvider)

func (*Router) Unbind added in v0.3.4

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

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

func (*Router) UserStreams added in v0.3.4

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

UserStreams returns all streams associated to a user.

type S2SOutProvider added in v0.3.4

type S2SOutProvider interface {
	GetS2SOut(localDomain, remoteDomain string) (stream.S2SOut, error)
}

Jump to

Keyboard shortcuts

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