networkInterface() virtual interfaces macos, networkInterfaceDefault() optimization Win
This commit is contained in:
parent
6bc333c397
commit
ed9203a367
@ -30,7 +30,8 @@ For major (breaking) changes - version 3 and 2 see end of page.
|
||||
|
||||
| Version | Date | Comment |
|
||||
| -------------- | -------------- | -------- |
|
||||
| 4.12.0 | 2019-06-19 | `networkInterface()` added property virtual |
|
||||
| 4.12.1 | 2019-06-24 | `networkInterface()` virtual interfaces macos, `networkInterfaceDefault()` |
|
||||
| 4.12.0 | 2019-06-21 | `networkInterface()` added property virtual |
|
||||
| 4.11.6 | 2019-06-19 | `util` bug fix |
|
||||
| 4.11.5 | 2019-06-19 | `dockerAll()` bug fix |
|
||||
| 4.11.4 | 2019-06-17 | type definitions bug fix |
|
||||
|
||||
@ -83,6 +83,12 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">4.12.1</th>
|
||||
<td>2019-06-24</td>
|
||||
<td><span class="code">networkInterface()</span> virtual interfaces macos<br>
|
||||
<span class="code">networkInterfaceDefault()</span> optimization windows</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">4.12.0</th>
|
||||
<td>2019-06-21</td>
|
||||
|
||||
@ -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.12.0</span></div>
|
||||
<div class="version">Current Version: <span id="version">4.12.1</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">
|
||||
|
||||
@ -64,8 +64,18 @@ function getDefaultNetworkInterface() {
|
||||
// https://www.inetdaemon.com/tutorials/internet/ip/routing/default_route.shtml
|
||||
const cmd = 'netstat -r';
|
||||
const result = execSync(cmd);
|
||||
const lines = result.toString().split(os.EOL)[0];
|
||||
const defaultIp = util.getValue('Default Gateway', lines, ':');
|
||||
const lines = result.toString().split(os.EOL);
|
||||
let defaultIp = '';
|
||||
lines.forEach(line => {
|
||||
line = line.replace(/\s+/g, ' ').trim();
|
||||
if (line.indexOf('0.0.0.0 0.0.0.0') > -1 && !(/[a-zA-Z]/.test(line))) {
|
||||
const parts = line.split(' ');
|
||||
if (parts.length >= 5) {
|
||||
defaultIp = parts[parts.length - 2];
|
||||
}
|
||||
}
|
||||
})
|
||||
if (defaultIp) {
|
||||
for (let dev in ifaces) {
|
||||
if (ifaces.hasOwnProperty(dev)) {
|
||||
ifaces[dev].forEach(function (details) {
|
||||
@ -76,6 +86,7 @@ function getDefaultNetworkInterface() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_linux || _darwin || _freebsd || _openbsd || _netbsd || _sunos) {
|
||||
let cmd = '';
|
||||
if (_linux) cmd = 'ip route 2> /dev/null | grep default | awk \'{print $5}\'';
|
||||
@ -330,7 +341,7 @@ function networkInterfaces(callback) {
|
||||
ip6: nic.ip6,
|
||||
mac: nic.mac,
|
||||
internal: nic.internal,
|
||||
virtual: testVirtualNic(nic.iface, nic.iface, nic.mac),
|
||||
virtual: nic.internal ? false : testVirtualNic(nic.iface, nic.iface, nic.mac),
|
||||
operstate: nic.operstate,
|
||||
type: nic.type,
|
||||
duplex: nic.duplex,
|
||||
@ -432,12 +443,6 @@ function networkInterfaces(callback) {
|
||||
operstate = util.getValue(lines, 'operstate');
|
||||
type = operstate === 'up' ? (util.getValue(lines, 'wireless').trim() ? 'wireless' : 'wired') : 'unknown';
|
||||
if (iface === 'lo' || iface.startsWith('bond')) { type = 'virtual'; }
|
||||
// rx_bytes = parseInt(util.getValue(lines, 'rx_bytes'), 10);
|
||||
// rx_dropped = parseInt(util.getValue(lines, 'rx_dropped'), 10);
|
||||
// rx_errors = parseInt(util.getValue(lines, 'rx_errors'), 10);
|
||||
// tx_bytes = parseInt(util.getValue(lines, 'tx_bytes'), 10);
|
||||
// tx_dropped = parseInt(util.getValue(lines, 'tx_dropped'), 10);
|
||||
// tx_errors = parseInt(util.getValue(lines, 'tx_errors'), 10);
|
||||
}
|
||||
if (_windows) {
|
||||
nics.forEach(detail => {
|
||||
@ -453,7 +458,7 @@ function networkInterfaces(callback) {
|
||||
}
|
||||
}
|
||||
let internal = (ifaces[dev] && ifaces[dev][0]) ? ifaces[dev][0].internal : null;
|
||||
const virtual = testVirtualNic(dev, ifaceName, mac);
|
||||
const virtual = internal ? false : testVirtualNic(dev, ifaceName, mac);
|
||||
result.push({
|
||||
iface: dev,
|
||||
ifaceName,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user