exchange

package
v2.3.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2018 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exchange

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

Exchange routes messages between northbound backends (servers that are up the chain) and southbound backends gateways or servers that are down the chain.

When a connection message is received on the southbound backend: - Uplink messages are routed from the southbound backends to the northbound backends - Downlink messages are routed from the northbound backends to the southbound backends - Status messages are routed from the southbound backends to the northbound backends until a disconnection message is received on the southbound backend

func New

func New(ctx log.Interface, killWhenIdleFor time.Duration) *Exchange

New initializes a new Exchange

func (*Exchange) AddNorthbound

func (b *Exchange) AddNorthbound(backend ...backend.Northbound)

AddNorthbound adds a new northbound backend (server that is up the chain)

func (*Exchange) AddSouthbound

func (b *Exchange) AddSouthbound(backend ...backend.Southbound)

AddSouthbound adds a new southbound backend (gateway or server that is down the chain)

func (*Exchange) ConnectGateway

func (b *Exchange) ConnectGateway(gatewayID ...string)

ConnectGateway force-connects gateways with the given IDs

func (*Exchange) InitRedisState

func (b *Exchange) InitRedisState(client *redis.Client, key string) (gatewayIDs []string)

InitRedisState initializes Redis-backed connection state for the exchange and returns the state stored in the database

func (*Exchange) SetAuth

func (b *Exchange) SetAuth(auth auth.Interface)

SetAuth sets the authentication component

func (*Exchange) SetID

func (b *Exchange) SetID(id string)

SetID sets the id of this bridge

func (*Exchange) SetMiddleware

func (b *Exchange) SetMiddleware(chain middleware.Chain)

SetMiddleware sets the middleware to be executed

func (*Exchange) Start

func (b *Exchange) Start(goroutines int, timeout time.Duration) (finishedWithinTimeout bool)

Start the Exchange

func (*Exchange) Stop

func (b *Exchange) Stop()

Stop the Exchange

Jump to

Keyboard shortcuts

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