Documentation
¶
Index ¶
- Constants
- Variables
- func BatchItems[T any](items []T, batchSize int) [][]T
- 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 DeleteAndCleanupHost(h *schema.Host)
- func GetID(topic string) (string, error)
- func HandleHostCheckin(h, currentHost *schema.Host) bool
- func HostUpdate(hostUpdate *models.HostUpdate) error
- func InitServerSync()
- func IsConnected() bool
- func IsConnectionOpen() bool
- func Keepalive(ctx context.Context)
- func KickOutClients() error
- func NodeUpdate(node *models.Node) error
- func PublishDeletedClientPeerUpdate(ctx context.Context, delClient *models.ExtClient) error
- func PublishDeletedNodePeerUpdate(ctx context.Context, delHost *schema.Host, delNode *models.Node) error
- func PublishIntegrationDelete(id string) error
- func PublishIntegrationUpsert(id string) error
- func PublishMqUpdatesForDeletedNode(ctx context.Context, delHost *schema.Host, node models.Node, ...)
- func PublishPeerUpdate(ctx context.Context, replacePeers bool) error
- func PublishPeerUpdatesForExitClientsFirst(ctx context.Context, clientNodes []models.Node) error
- func PublishPeerUpdatesToExitClientHosts(ctx context.Context, clientNodes []models.Node) error
- func PublishSingleHostPeerUpdate(ctx context.Context, host *schema.Host, allNodes []models.Node, ...) error
- func PushAllMetricsToExporter(ctx context.Context)
- func PushSyncDNS(dnsEntries []models.DNSEntry) error
- func SendDNSSyncByNetwork(ctx context.Context, network string) error
- func SendPullSYN() error
- func ServerStartNotify() error
- func SetupMQTT(fatal bool)
- func SignalPeer(signal models.Signal)
- func StartPeerUpdateWorker(ctx context.Context)
- func UpdateHost(client mqtt.Client, msg mqtt.Message)
- func UpdateNode(client mqtt.Client, msg mqtt.Message)
- type Emqx
- type EmqxCloud
- func (e *EmqxCloud) CreateDefaultAllowRule() 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) DeleteEmqxUser(username string) error
- func (e *EmqxCloud) GetType() servercfg.Emqxdeploy
- type EmqxOnPrem
- func (e *EmqxOnPrem) CreateDefaultAllowRule() 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) DeleteEmqxUser(username string) error
- func (e *EmqxOnPrem) GetType() servercfg.Emqxdeploy
Constants ¶
const CHECKIN_FLUSH_INTERVAL = 30
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 HandleExporterIntegrationPull = func(client mqtt.Client, msg mqtt.Message) {}
var UpdateMetrics = func(client mqtt.Client, msg mqtt.Message) {
}
UpdateMetrics message Handler -- handles updates from client nodes for metrics
Functions ¶
func BatchItems ¶ added in v0.25.0
func ClientPeerUpdate ¶
ClientPeerUpdate message handler -- handles updating peers after signal from client nodes
func DefaultHandler ¶
DefaultHandler default message queue handler -- NOT USED
func DeleteAndCleanupHost ¶ added in v1.2.0
func HandleHostCheckin ¶ added in v0.22.0
func HostUpdate ¶
func HostUpdate(hostUpdate *models.HostUpdate) error
HostUpdate -- publishes a host update to clients
func InitServerSync ¶ added in v1.5.1
func InitServerSync()
InitServerSync wires up the logic.PublishServerSync hook so that mutations in the logic package can broadcast sync signals without importing mq (avoiding circular imports).
func IsConnected ¶
func IsConnected() bool
IsConnected - function for determining if the mqclient is connected or not
func IsConnectionOpen ¶ added in v0.24.3
func IsConnectionOpen() bool
IsConnectionOpen - 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 ¶
func PublishDeletedNodePeerUpdate(ctx context.Context, delHost *schema.Host, delNode *models.Node) error
PublishDeletedNodePeerUpdate --- determines and publishes a peer update to all the hosts with a deleted node to account for
func PublishIntegrationDelete ¶ added in v1.6.0
func PublishIntegrationUpsert ¶ added in v1.6.0
func PublishMqUpdatesForDeletedNode ¶ added in v0.21.2
func PublishMqUpdatesForDeletedNode(ctx context.Context, delHost *schema.Host, node models.Node, sendNodeUpdate bool)
PublishMqUpdatesForDeletedNode - published all the required updates for deleted host and node
func PublishPeerUpdate ¶
PublishPeerUpdate --- queues a peer update for a tenant that will be coalesced with other rapid-fire updates via a debounce window (500ms) capped by a max-wait (3s).
func PublishPeerUpdatesForExitClientsFirst ¶ added in v1.7.0
PublishPeerUpdatesForExitClientsFirst pushes a peer update to each unique host among exit-node clients synchronously, then queues a global peer update. Call this when an exit becomes unavailable (routing node disconnect or internet egress disabled) so clients drop full-tunnel routes before the rest of the mesh updates.
func PublishPeerUpdatesToExitClientHosts ¶ added in v1.7.0
PublishPeerUpdatesToExitClientHosts pushes a peer update to each unique host among the given exit-node clients (no global mesh update). Used to fail-open full-tunnel routes before a routing node is removed.
func PublishSingleHostPeerUpdate ¶
func PublishSingleHostPeerUpdate(ctx context.Context, host *schema.Host, allNodes []models.Node, deletedHost *schema.Host, deletedNode *models.Node, deletedClients []models.ExtClient, replacePeers bool, wg *sync.WaitGroup) error
PublishSingleHostPeerUpdate --- determines and publishes a peer update to one host
func PushAllMetricsToExporter ¶ added in v1.5.1
PushAllMetricsToExporter fetches all node metrics from the database and POSTs them as a batch to the exporter's HTTP API. Called periodically by a ticker instead of on every individual metrics MQTT message.
func PushSyncDNS ¶ added in v0.26.0
func SendDNSSyncByNetwork ¶ added in v0.26.0
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 SignalPeer ¶ added in v1.2.0
func StartPeerUpdateWorker ¶ added in v1.5.1
StartPeerUpdateWorker --- runs a background goroutine for a given tenant that coalesces peer update signals using a resettable debounce timer capped by an absolute max-wait deadline. This ensures rapid-fire PublishPeerUpdate calls result in a single broadcast, while guaranteeing peers never wait longer than peerUpdateMaxWait from the first signal.
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
CreateDefaultAllowRule() 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) CreateDefaultAllowRule ¶ added in v0.24.3
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) DeleteEmqxUser ¶ added in v0.23.0
func (*EmqxCloud) GetType ¶ added in v0.23.0
func (e *EmqxCloud) GetType() servercfg.Emqxdeploy
type EmqxOnPrem ¶ added in v0.23.0
func (*EmqxOnPrem) CreateDefaultAllowRule ¶ added in v0.24.3
func (e *EmqxOnPrem) CreateDefaultAllowRule() error
CreateDefaultAllowRule - 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) 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