extended FreeBSD support networkConnections()
This commit is contained in:
+5
-7
@@ -187,7 +187,7 @@ function getDynamicData(srv, iface, callback) {
|
||||
let functionProcessed = (function () {
|
||||
let totalFunctions = 14;
|
||||
if (_windows) totalFunctions = 10;
|
||||
if (_freebsd || _openbsd) totalFunctions = 10;
|
||||
if (_freebsd || _openbsd) totalFunctions = 11;
|
||||
|
||||
return function () {
|
||||
if (--totalFunctions === 0) {
|
||||
@@ -255,12 +255,10 @@ function getDynamicData(srv, iface, callback) {
|
||||
});
|
||||
}
|
||||
|
||||
if (!_openbsd && !_freebsd) {
|
||||
network.networkConnections().then(res => {
|
||||
data.networkConnections = res;
|
||||
functionProcessed();
|
||||
});
|
||||
}
|
||||
network.networkConnections().then(res => {
|
||||
data.networkConnections = res;
|
||||
functionProcessed();
|
||||
});
|
||||
|
||||
memory.mem().then(res => {
|
||||
data.mem = res;
|
||||
|
||||
+2
-1
@@ -403,8 +403,9 @@ function networkConnections(callback) {
|
||||
return new Promise((resolve) => {
|
||||
process.nextTick(() => {
|
||||
let result = [];
|
||||
if (_linux) {
|
||||
if (_linux || _freebsd || _openbsd) {
|
||||
let cmd = 'netstat -tuna | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN\\|VERBUNDEN"';
|
||||
if (_freebsd || _openbsd) cmd = 'netstat -na | grep "ESTABLISHED\\|SYN_SENT\\|SYN_RECV\\|FIN_WAIT1\\|FIN_WAIT2\\|TIME_WAIT\\|CLOSE\\|CLOSE_WAIT\\|LAST_ACK\\|LISTEN\\|CLOSING\\|UNKNOWN\\|VERBUNDEN"'
|
||||
exec(cmd, function (error, stdout) {
|
||||
if (!error) {
|
||||
let lines = stdout.toString().split('\n');
|
||||
|
||||
Reference in New Issue
Block a user