docs updated, code cleanup networkInterfaces()

This commit is contained in:
Sebastian Hildebrandt
2020-01-04 19:23:05 +01:00
parent 6e98139272
commit dfcb9a3927
6 changed files with 67 additions and 17 deletions
+7 -11
View File
@@ -336,9 +336,7 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
const iface8021xInfo = ifaces.find((element) => {
return element.includes(iface + '\r\n');
});
const arrayIface8021xInfo = iface8021xInfo.split('\r\n')
const arrayIface8021xInfo = iface8021xInfo.split('\r\n');
const state8021x = arrayIface8021xInfo.find((element) => {
return element.includes('802.1x');
});
@@ -346,16 +344,13 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
if (state8021x.includes('Disabled')) {
i8021x.state = "Disabled";
i8021x.protocol = "Not defined";
} else if (state8021x.includes('Enabled')) {
const protocol8021x = arrayIface8021xInfo.find((element) => {
return element.includes('EAP');
});
i8021x.protocol = protocol8021x.split(':').pop();
i8021x.state = "Enabled";
}
} catch (error) {
// console.log('Error getting wired information:', error);
return i8021x;
@@ -493,6 +488,7 @@ function getLinuxIfaceConnectionName(interfaceName) {
}
function getLinuxIfaceDHCPstatus(connectionName) {
let result = false;
if (connectionName) {
const cmd = `nmcli connection show "${connectionName}" \| grep ipv4.method;`;
try {
@@ -502,19 +498,19 @@ function getLinuxIfaceDHCPstatus(connectionName) {
let dhcStatus = resultFormat.split(" ").slice(1).toString();
switch (dhcStatus) {
case 'auto':
dhcStatus = true;
result = true;
break;
default:
dhcStatus = false;
result = false;
break;
}
return dhcStatus;
return result;
} catch (e) {
return 'Unknown';
return result;
}
} else {
return 'Unknown';
return result;
}
}