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

View File

@ -30,7 +30,8 @@ For major (breaking) changes - version 3 and 2 see end of page.
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 4.16.0 | 2019-11-27 | `networkInterfaces()` bug fix (osx) |
| 4.17.0 | 2020-01-04 | `networkInterfaces()` added dhcp, dnsSuffix, ieee8021xAuth, ieee8021xState |
| 4.16.1 | 2020-01-02 | `networkInterfaces()` bug fix (osx) |
| 4.16.0 | 2019-11-27 | `networkGatewayDefault()` added |
| 4.15.3 | 2019-11-10 | type definitions and docs update |
| 4.15.2 | 2019-11-10 | `mem()` improved calculation linux |

View File

@ -98,13 +98,13 @@ si.cpu()
(last 7 major and minor version releases)
- Version 4.17.0: `networkInterfaces()` added dhcp, dnsSuffix, ieee8021xAuth, ieee8021xState
- Version 4.16.0: `networkGatewayDefault()` added
- Version 4.15.0: `cpu()` added governor (linux)
- Version 4.14.0: `processes()` added process path and params
- Version 4.13.0: `networkConnections()` added PID, process
- Version 4.12.0: `networkInterfaces()` added property virtual
- Version 4.11.0: `wifiNetworks()` added available wifi networks
- Version 4.10.0: `graphics()` added windows multiple display support, added display size, connection, ...
- ...
You can find all changes here: [detailed changelog][changelog-url]
@ -447,6 +447,14 @@ I also created a nice little command line tool called [mmon][mmon-github-url] (
| | [0].duplex | X | | X | | | duplex |
| | [0].mtu | X | | X | | | maximum transmission unit |
| | [0].speed | X | | X | X | | speed in MBit / s |
| | [0].dhcp | X | | | X | | DHCP address |
| | [0].dnsSuffix | X | | | X | | DNS suffix |
| | [0].ieee8021xAuth | X | | | X | | IEEE 802.1x auth |
| | [0].ieee8021xState | X | | | X | | IEEE 802.1x state |
dhcp: boolean;
dnsSuffix: string;
ieee8021xAuth: string;
ieee8021xState: string;
| | [0].carrierChanges | X | | | | | # changes up/down |
| si.networkInterfaceDefault(cb) | : string | X | X | X | X | X | get name of default network interface |
| si.networkGatewayDefault(cb) | : string | X | X | X | X | X | get default network gateway |

View File

@ -83,9 +83,14 @@
</tr>
</thead>
<tbody>
<tr>
<th scope="row">4.17.0</th>
<td>2020-01-04</td>
<td><span class="code">networkInterfaces()</span> added dhcp, dnsSuffix, ieee8021xAuth, ieee8021xState</td>
</tr>
<tr>
<th scope="row">4.16.1</th>
<td>2019-01-01</td>
<td>2020-01-01</td>
<td><span class="code">networkInterfaces()</span> bug fix (osx)</td>
</tr>
<tr>

View File

@ -168,7 +168,7 @@
<img class="logo" src="assets/logo.png">
<div class="title">systeminformation</div>
<div class="subtitle"><span id="typed"></span></div>
<div class="version">Current Version: <span id="version">4.16.1</span></div>
<div class="version">Current Version: <span id="version">4.17.0</span></div>
<button class="btn btn-light" onclick="location.href='https://github.com/sebhildebrandt/systeminformation'">View on Github <i class=" fab fa-github"></i></button>
</div>
<div class="down">
@ -191,7 +191,7 @@
</div>
<div class="row number-section">
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
<div class="numbers">9,471</div>
<div class="numbers">9,756</div>
<div class="title">Lines of code</div>
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
@ -199,7 +199,7 @@
<div class="title">Downloads last month</div>
</div>
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
<div class="numbers">231</div>
<div class="numbers">233</div>
<div class="title">Dependends</div>
</div>
</div>

View File

@ -195,6 +195,46 @@
<td></td>
<td>Speed in Mbit / s</td>
</tr>
<tr>
<td></td>
<td>[0].dhcp</td>
<td>X</td>
<td></td>
<td></td>
<td>X</td>
<td></td>
<td>DHCP address</td>
</tr>
<tr>
<td></td>
<td>[0].dnsSuffix</td>
<td>X</td>
<td></td>
<td></td>
<td>X</td>
<td></td>
<td>DNS suffix</td>
</tr>
<tr>
<td></td>
<td>[0].ieee8021xAuth</td>
<td>X</td>
<td></td>
<td></td>
<td>X</td>
<td></td>
<td>IEEE 802.1x Auth</td>
</tr>
<tr>
<td></td>
<td>[0].ieee8021xState</td>
<td>X</td>
<td></td>
<td>X</td>
<td>X</td>
<td></td>
<td>IEEE 802.1x State</td>
</tr>
<tr>
<td></td>
<td>[0].carrierChanges</td>

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;
}
}