routers

package
v0.0.0-...-62a6041 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connections

type Connections interface {
	Add(clientId string, conn model.TagyouConn)
	Exists(clientId string) (model.TagyouConn, bool)
	Close(clientId string) error
	Remove(clientId string)
}

type Router

type Router interface {
	Send(clientId string, payload []byte)
	Forward(topic string, packet *packet.Packet)
	AddDestination(clientId string, conn model.TagyouConn)
	RemoveDestination(clientId string)
	DestinationExists(clientId string) bool
}

func NewSimple

func NewSimple() Router

type SimpleConnections

type SimpleConnections struct {
	Conns map[string]model.TagyouConn
	Mu    sync.RWMutex
}

func (*SimpleConnections) Add

func (c *SimpleConnections) Add(clientId string, conn model.TagyouConn)

func (*SimpleConnections) Close

func (c *SimpleConnections) Close(clientId string) error

func (*SimpleConnections) Exists

func (c *SimpleConnections) Exists(clientId string) (model.TagyouConn, bool)

func (*SimpleConnections) Remove

func (c *SimpleConnections) Remove(clientId string)

type SimpleRouter

type SimpleRouter struct {
	Conns Connections
}

func (SimpleRouter) AddDestination

func (s SimpleRouter) AddDestination(clientId string, conn model.TagyouConn)

func (SimpleRouter) DestinationExists

func (s SimpleRouter) DestinationExists(clientId string) bool

func (SimpleRouter) Forward

func (s SimpleRouter) Forward(topic string, p *packet.Packet)

func (SimpleRouter) RemoveDestination

func (s SimpleRouter) RemoveDestination(clientId string)

func (SimpleRouter) Send

func (s SimpleRouter) Send(clientId string, payload []byte)

Jump to

Keyboard shortcuts

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