gateway

package
v0.0.0-...-41124b9 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BrMsgID

type BrMsgID struct {
	ID        string
	ChannelID string
	// contains filtered or unexported fields
}

type Gateway

type Gateway struct {
	config.Config

	Router         *Router
	MyConfig       *config.Gateway
	Bridges        map[string]*bridge.Bridge
	Channels       map[string]*config.ChannelInfo
	ChannelOptions map[string]config.ChannelOptions
	Message        chan config.Message
	Name           string
	Messages       *lru.Cache
	// contains filtered or unexported fields
}

func New

func New(rootLogger *logrus.Logger, cfg *config.Gateway, r *Router) *Gateway

New creates a new Gateway object associated with the specified router and following the given configuration.

func (*Gateway) AddBridge

func (gw *Gateway) AddBridge(cfg *config.Bridge) error

AddBridge sets up a new bridge in the gateway object with the specified configuration.

func (*Gateway) AddConfig

func (gw *Gateway) AddConfig(cfg *config.Gateway) error

AddConfig associates a new configuration with the gateway object.

func (*Gateway) FindCanonicalMsgID

func (gw *Gateway) FindCanonicalMsgID(protocol string, mID string) string

FindCanonicalMsgID returns the ID under which a message was stored in the cache.

func (*Gateway) SendMessage

func (gw *Gateway) SendMessage(
	rmsg *config.Message,
	dest *bridge.Bridge,
	channel *config.ChannelInfo,
	canonicalParentMsgID string,
) (string, error)

SendMessage sends a message (with specified parentID) to the channel on the selected destination bridge and returns a message ID or an error.

type Router

type Router struct {
	config.Config
	sync.RWMutex

	BridgeMap        map[string]bridge.Factory
	Gateways         map[string]*Gateway
	Message          chan config.Message
	MattermostPlugin chan config.Message
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(rootLogger *logrus.Logger, cfg config.Config, bridgeMap map[string]bridge.Factory) (*Router, error)

NewRouter initializes a new Matterbridge router for the specified configuration and sets up all required gateways.

func (*Router) Start

func (r *Router) Start() error

Start will connect all gateways belonging to this router and subsequently route messages between them.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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