mq

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
const KEEPALIVE_TIMEOUT = 60 //timeout in seconds

KEEPALIVE_TIMEOUT - time in seconds for timeout

View Source
const MQ_DISCONNECT = 250

MQ_DISCONNECT - disconnects MQ

View Source
const MQ_TIMEOUT = 30

MQ_TIMEOUT - timeout for MQ

Variables

View Source
var UpdateMetrics = func(client mqtt.Client, msg mqtt.Message) {
}

UpdateMetrics message Handler -- handles updates from client nodes for metrics

Functions

func AppendNodeUpdateACL

func AppendNodeUpdateACL(hostID, nodeNetwork, nodeID, serverName string) error

AppendNodeUpdateACL - adds ACL rule for subscribing to node updates for a node ID

func ClientPeerUpdate

func ClientPeerUpdate(client mqtt.Client, msg mqtt.Message)

ClientPeerUpdate message handler -- handles updating peers after signal from client nodes

func CloseClient

func CloseClient()

CloseClient - function to close the mq connection from server

func CreateDefaultDenyRule

func CreateDefaultDenyRule() error

CreateDefaultDenyRule - creates a rule to deny access to all topics for all users by default to allow user access to topics use the `mq.CreateUserAccessRule` function

func CreateEmqxDefaultAuthenticator

func CreateEmqxDefaultAuthenticator() error

CreateEmqxDefaultAuthenticator - creates a default authenticator based on password and using EMQX's built in database as storage

func CreateEmqxDefaultAuthorizer

func CreateEmqxDefaultAuthorizer() error

CreateEmqxDefaultAuthorizer - creates a default ACL authorization mechanism based on the built in database

func CreateEmqxUser

func CreateEmqxUser(username, password string, admin bool) error

CreateEmqxUser - creates an EMQX user

func CreateHostACL

func CreateHostACL(hostID, serverName string) error

CreateHostACL - create host ACL rules

func DecryptMsg

func DecryptMsg(node *models.Node, msg []byte) ([]byte, error)

func DefaultHandler

func DefaultHandler(client mqtt.Client, msg mqtt.Message)

DefaultHandler default message queue handler -- NOT USED

func DeleteEmqxUser

func DeleteEmqxUser(username string) error

DeleteEmqxUser - deletes an EMQX user

func GetID

func GetID(topic string) (string, error)

decodes a message queue topic and returns the embedded node.ID

func GetUserACL

func GetUserACL(username string) (*aclObject, error)

GetUserACL - returns ACL rules by username

func HostUpdate

func HostUpdate(hostUpdate *models.HostUpdate) error

HostUpdate -- publishes a host update to clients

func IsConnected

func IsConnected() bool

IsConnected - function for determining if the mqclient is connected or not

func Keepalive

func Keepalive(ctx context.Context)

Keepalive -- periodically pings all nodes to let them know server is still alive and doing well

func NodeUpdate

func NodeUpdate(node *models.Node) error

NodeUpdate -- publishes a node update

func PublishAllDNS

func PublishAllDNS(newnode *models.Node) error

PublishAllDNS publishes an array of dns updates (ip / host.network) for each peer to a node joining a network

func PublishCustomDNS

func PublishCustomDNS(entry *models.DNSEntry) error

PublishCustomDNS publish dns update for new custom dns entry

func PublishDNSDelete

func PublishDNSDelete(node *models.Node, host *models.Host) error

PublishDNSDelete publish a dns update deleting a node to all hosts on a network

func PublishDNSUpdate

func PublishDNSUpdate(network string, dns models.DNSUpdate) error

PublishDNSUpdate publishes a dns update to all nodes on a network

func PublishDeleteExtClientDNS

func PublishDeleteExtClientDNS(client *models.ExtClient) error

PublishDeleteExtClientDNS publish dns update to delete extclient entry

func PublishDeletedClientPeerUpdate

func PublishDeletedClientPeerUpdate(delClient *models.ExtClient) error

PublishDeletedClientPeerUpdate --- determines and publishes a peer update to all the hosts with a deleted ext client to account for

func PublishDeletedNodePeerUpdate

func PublishDeletedNodePeerUpdate(delNode *models.Node) error

PublishDeletedNodePeerUpdate --- determines and publishes a peer update to all the hosts with a deleted node to account for

func PublishExtClientDNS

func PublishExtClientDNS(client *models.ExtClient) error

PublishExtClientDNS publish dns update for new extclient

func PublishExtClientDNSUpdate

func PublishExtClientDNSUpdate(old, new models.ExtClient, network string) error

PublishExtClientDNSUpdate update for extclient name change

func PublishHostDNSUpdate

func PublishHostDNSUpdate(old, new *models.Host, networks []string) error

PublishHostDNSUpdate publishes dns update on host name change

func PublishPeerUpdate

func PublishPeerUpdate() error

PublishPeerUpdate --- determines and publishes a peer update to all the hosts

func PublishReplaceDNS

func PublishReplaceDNS(oldNode, newNode *models.Node, host *models.Host) error

PublishReplaceDNS publish a dns update to replace a dns entry on all hosts in network

func PublishSingleHostPeerUpdate

func PublishSingleHostPeerUpdate(host *models.Host, allNodes []models.Node, deletedNode *models.Node, deletedClients []models.ExtClient) error

PublishSingleHostPeerUpdate --- determines and publishes a peer update to one host

func PushMetricsToExporter

func PushMetricsToExporter(metrics models.Metrics) error

func ServerStartNotify

func ServerStartNotify() error

ServerStartNotify - notifies all non server nodes to pull changes after a restart

func SetupMQTT

func SetupMQTT()

SetupMQTT creates a connection to broker and return client

func UpdateHost

func UpdateHost(client mqtt.Client, msg mqtt.Message)

UpdateHost message Handler -- handles host updates from clients

func UpdateNode

func UpdateNode(client mqtt.Client, msg mqtt.Message)

UpdateNode message Handler -- handles updates from client nodes

Types

This section is empty.

Jump to

Keyboard shortcuts

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