Documentation ¶
Index ¶
- Constants
- Variables
- func ClientPeerUpdate(client mqtt.Client, msg mqtt.Message)
- func CloseClient()
- func DecryptMsg(node *models.Node, msg []byte) ([]byte, error)
- func DefaultHandler(client mqtt.Client, msg mqtt.Message)
- func GetID(topic string) (string, error)
- func HandleHostCheckin(h, currentHost *models.Host) bool
- func HostUpdate(hostUpdate *models.HostUpdate) error
- func IsConnected() bool
- func Keepalive(ctx context.Context)
- func KickOutClients() error
- func NodeUpdate(node *models.Node) error
- func PublishDeletedClientPeerUpdate(delClient *models.ExtClient) error
- func PublishDeletedNodePeerUpdate(delNode *models.Node) error
- func PublishMqUpdatesForDeletedNode(node models.Node, sendNodeUpdate bool, gwClients []models.ExtClient)
- func PublishPeerUpdate(replacePeers bool) error
- func PublishSingleHostPeerUpdate(host *models.Host, allNodes []models.Node, deletedNode *models.Node, ...) error
- func PushMetricsToExporter(metrics models.Metrics) error
- func SendPullSYN() error
- func ServerStartNotify() error
- func SetupMQTT(fatal bool)
- func UpdateHost(client mqtt.Client, msg mqtt.Message)
- func UpdateNode(client mqtt.Client, msg mqtt.Message)
- type Emqx
- type EmqxCloud
- func (e *EmqxCloud) AppendNodeUpdateACL(hostID, nodeNetwork, nodeID, serverName string) error
- func (e *EmqxCloud) CreateDefaultDenyRule() error
- func (e *EmqxCloud) CreateEmqxDefaultAuthenticator() error
- func (e *EmqxCloud) CreateEmqxDefaultAuthorizer() error
- func (e *EmqxCloud) CreateEmqxUser(username, pass string) error
- func (e *EmqxCloud) CreateEmqxUserforServer() error
- func (e *EmqxCloud) CreateHostACL(hostID, serverName string) error
- func (e *EmqxCloud) DeleteEmqxUser(username string) error
- func (e *EmqxCloud) GetType() servercfg.Emqxdeploy
- func (e *EmqxCloud) GetUserACL(username string) (*aclObject, error)
- type EmqxOnPrem
- func (e *EmqxOnPrem) AppendNodeUpdateACL(hostID, nodeNetwork, nodeID, serverName string) error
- func (e *EmqxOnPrem) CreateDefaultDenyRule() error
- func (e *EmqxOnPrem) CreateEmqxDefaultAuthenticator() error
- func (e *EmqxOnPrem) CreateEmqxDefaultAuthorizer() error
- func (e *EmqxOnPrem) CreateEmqxUser(username, password string) error
- func (e *EmqxOnPrem) CreateEmqxUserforServer() error
- func (e *EmqxOnPrem) CreateHostACL(hostID, serverName string) error
- func (e *EmqxOnPrem) DeleteEmqxUser(username string) error
- func (e *EmqxOnPrem) GetType() servercfg.Emqxdeploy
- func (e *EmqxOnPrem) GetUserACL(username string) (*aclObject, error)
Constants ¶
const KEEPALIVE_TIMEOUT = 60 //timeout in seconds
KEEPALIVE_TIMEOUT - time in seconds for timeout
const MQ_DISCONNECT = 250
MQ_DISCONNECT - disconnects MQ
const MQ_TIMEOUT = 30
MQ_TIMEOUT - timeout for MQ
Variables ¶
var UpdateMetrics = func(client mqtt.Client, msg mqtt.Message) {
}
UpdateMetrics message Handler -- handles updates from client nodes for metrics
var UpdateMetricsFallBack = func(nodeid string, newMetrics models.Metrics) {}
Functions ¶
func ClientPeerUpdate ¶
ClientPeerUpdate message handler -- handles updating peers after signal from client nodes
func DefaultHandler ¶
DefaultHandler default message queue handler -- NOT USED
func HandleHostCheckin ¶ added in v0.22.0
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 ¶
Keepalive -- periodically pings all nodes to let them know server is still alive and doing well
func KickOutClients ¶ added in v0.24.0
func KickOutClients() error
func PublishDeletedClientPeerUpdate ¶
PublishDeletedClientPeerUpdate --- determines and publishes a peer update to all the hosts with a deleted ext client to account for
func PublishDeletedNodePeerUpdate ¶
PublishDeletedNodePeerUpdate --- determines and publishes a peer update to all the hosts with a deleted node to account for
func PublishMqUpdatesForDeletedNode ¶ added in v0.21.2
func PublishMqUpdatesForDeletedNode(node models.Node, sendNodeUpdate bool, gwClients []models.ExtClient)
PublishMqUpdatesForDeletedNode - published all the required updates for deleted node
func PublishPeerUpdate ¶
PublishPeerUpdate --- determines and publishes a peer update to all the hosts
func PublishSingleHostPeerUpdate ¶
func PublishSingleHostPeerUpdate(host *models.Host, allNodes []models.Node, deletedNode *models.Node, deletedClients []models.ExtClient, replacePeers bool) error
PublishSingleHostPeerUpdate --- determines and publishes a peer update to one host
func PushMetricsToExporter ¶
func SendPullSYN ¶ added in v0.24.0
func SendPullSYN() error
func ServerStartNotify ¶
func ServerStartNotify() error
ServerStartNotify - notifies all non server nodes to pull changes after a restart
func SetupMQTT ¶
func SetupMQTT(fatal bool)
SetupMQTT creates a connection to broker and return client
func UpdateHost ¶
UpdateHost message Handler -- handles host updates from clients
Types ¶
type Emqx ¶ added in v0.23.0
type Emqx interface { GetType() servercfg.Emqxdeploy CreateEmqxUser(username, password string) error CreateEmqxUserforServer() error CreateEmqxDefaultAuthenticator() error CreateEmqxDefaultAuthorizer() error CreateDefaultDenyRule() error CreateHostACL(hostID, serverName string) error AppendNodeUpdateACL(hostID, nodeNetwork, nodeID, serverName string) error GetUserACL(username string) (*aclObject, error) DeleteEmqxUser(username string) error }
func GetEmqxHandler ¶ added in v0.23.0
func GetEmqxHandler() Emqx
GetEmqxHandler - gets emqx handler
type EmqxCloud ¶ added in v0.23.0
func (*EmqxCloud) AppendNodeUpdateACL ¶ added in v0.23.0
func (*EmqxCloud) CreateDefaultDenyRule ¶ added in v0.23.0
func (*EmqxCloud) CreateEmqxDefaultAuthenticator ¶ added in v0.23.0
func (*EmqxCloud) CreateEmqxDefaultAuthorizer ¶ added in v0.23.0
func (*EmqxCloud) CreateEmqxUser ¶ added in v0.23.0
func (*EmqxCloud) CreateEmqxUserforServer ¶ added in v0.23.0
func (*EmqxCloud) CreateHostACL ¶ added in v0.23.0
func (*EmqxCloud) DeleteEmqxUser ¶ added in v0.23.0
func (*EmqxCloud) GetType ¶ added in v0.23.0
func (e *EmqxCloud) GetType() servercfg.Emqxdeploy
func (*EmqxCloud) GetUserACL ¶ added in v0.23.0
type EmqxOnPrem ¶ added in v0.23.0
func (*EmqxOnPrem) AppendNodeUpdateACL ¶ added in v0.23.0
func (e *EmqxOnPrem) AppendNodeUpdateACL(hostID, nodeNetwork, nodeID, serverName string) error
AppendNodeUpdateACL - adds ACL rule for subscribing to node updates for a node ID
func (*EmqxOnPrem) CreateDefaultDenyRule ¶ added in v0.23.0
func (e *EmqxOnPrem) 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 (*EmqxOnPrem) CreateEmqxDefaultAuthenticator ¶ added in v0.23.0
func (e *EmqxOnPrem) CreateEmqxDefaultAuthenticator() error
CreateEmqxDefaultAuthenticator - creates a default authenticator based on password and using EMQX's built in database as storage
func (*EmqxOnPrem) CreateEmqxDefaultAuthorizer ¶ added in v0.23.0
func (e *EmqxOnPrem) CreateEmqxDefaultAuthorizer() error
CreateEmqxDefaultAuthorizer - creates a default ACL authorization mechanism based on the built in database
func (*EmqxOnPrem) CreateEmqxUser ¶ added in v0.23.0
func (e *EmqxOnPrem) CreateEmqxUser(username, password string) error
CreateEmqxUser - creates an EMQX user
func (*EmqxOnPrem) CreateEmqxUserforServer ¶ added in v0.23.0
func (e *EmqxOnPrem) CreateEmqxUserforServer() error
func (*EmqxOnPrem) CreateHostACL ¶ added in v0.23.0
func (e *EmqxOnPrem) CreateHostACL(hostID, serverName string) error
CreateHostACL - create host ACL rules
func (*EmqxOnPrem) DeleteEmqxUser ¶ added in v0.23.0
func (e *EmqxOnPrem) DeleteEmqxUser(username string) error
DeleteEmqxUser - deletes an EMQX user
func (*EmqxOnPrem) GetType ¶ added in v0.23.0
func (e *EmqxOnPrem) GetType() servercfg.Emqxdeploy
func (*EmqxOnPrem) GetUserACL ¶ added in v0.23.0
func (e *EmqxOnPrem) GetUserACL(username string) (*aclObject, error)
GetUserACL - returns ACL rules by username