mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-25 06:35:54 -05:00
Added DropAllCira command to server console, #2976
This commit is contained in:
parent
40eb8762e2
commit
d7e41d8366
@ -5448,6 +5448,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
'dbcounters': [serverUserCommandDbCounters, ""],
|
||||
'dbstats': [serverUserCommandDbStats, ""],
|
||||
'dispatchtable': [serverUserCommandDispatchTable, ""],
|
||||
'dropallcira': [serverUserCommandDropAllCira, ""],
|
||||
'dupagents': [serverUserCommandDupAgents, ""],
|
||||
'email': [serverUserCommandEmail, ""],
|
||||
'firebase': [serverUserCommandFirebase, ""],
|
||||
@ -5854,6 +5855,12 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
}
|
||||
}
|
||||
|
||||
function serverUserCommandDropAllCira(cmdData) {
|
||||
if (parent.parent.mpsserver == null) { cmdData.result = 'MPS not setup.'; return; }
|
||||
const dropCount = parent.parent.mpsserver.dropAllConnections();
|
||||
cmdData.result = 'Dropped ' + dropCount + ' connection(s).';
|
||||
}
|
||||
|
||||
function serverUserCommandDupAgents(cmdData) {
|
||||
for (var i in parent.duplicateAgentsLog) {
|
||||
cmdData.result += JSON.stringify(parent.duplicateAgentsLog[i]) + '\r\n';
|
||||
|
10
mpsserver.js
10
mpsserver.js
@ -1325,6 +1325,16 @@ module.exports.CreateMpsServer = function (parent, db, args, certificates) {
|
||||
for (var i in obj.httpResponses) { if ((obj.httpResponses[i].maxtime != null) && (obj.httpResponses[i].maxtime < now)) { delete obj.httpResponses[i]; } }
|
||||
}
|
||||
|
||||
// Drop all CIRA connections
|
||||
obj.dropAllConnections = function () {
|
||||
var dropCount = 0;
|
||||
for (var nodeid in obj.ciraConnections) {
|
||||
const connections = obj.ciraConnections[nodeid];
|
||||
for (var i in connections) { if (connections[i].end) { connections[i].end(); dropCount++; } } // This will drop all TCP CIRA connections
|
||||
}
|
||||
return dropCount;
|
||||
}
|
||||
|
||||
function guidToStr(g) { return g.substring(6, 8) + g.substring(4, 6) + g.substring(2, 4) + g.substring(0, 2) + "-" + g.substring(10, 12) + g.substring(8, 10) + "-" + g.substring(14, 16) + g.substring(12, 14) + "-" + g.substring(16, 20) + "-" + g.substring(20); }
|
||||
|
||||
// Clean a IPv6 address that encodes a IPv4 address
|
||||
|
Loading…
Reference in New Issue
Block a user