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 |
|
| 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.6 | 2019-06-19 | `util` bug fix |
|
||||||
| 4.11.5 | 2019-06-19 | `dockerAll()` bug fix |
|
| 4.11.5 | 2019-06-19 | `dockerAll()` bug fix |
|
||||||
| 4.11.4 | 2019-06-17 | type definitions bug fix |
|
| 4.11.4 | 2019-06-17 | type definitions bug fix |
|
||||||
|
|||||||
@ -83,6 +83,12 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<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>
|
<tr>
|
||||||
<th scope="row">4.12.0</th>
|
<th scope="row">4.12.0</th>
|
||||||
<td>2019-06-21</td>
|
<td>2019-06-21</td>
|
||||||
|
|||||||
@ -168,7 +168,7 @@
|
|||||||
<img class="logo" src="assets/logo.png">
|
<img class="logo" src="assets/logo.png">
|
||||||
<div class="title">systeminformation</div>
|
<div class="title">systeminformation</div>
|
||||||
<div class="subtitle"><span id="typed"></span></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>
|
<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>
|
||||||
<div class="down">
|
<div class="down">
|
||||||
|
|||||||
@ -64,15 +64,26 @@ function getDefaultNetworkInterface() {
|
|||||||
// https://www.inetdaemon.com/tutorials/internet/ip/routing/default_route.shtml
|
// https://www.inetdaemon.com/tutorials/internet/ip/routing/default_route.shtml
|
||||||
const cmd = 'netstat -r';
|
const cmd = 'netstat -r';
|
||||||
const result = execSync(cmd);
|
const result = execSync(cmd);
|
||||||
const lines = result.toString().split(os.EOL)[0];
|
const lines = result.toString().split(os.EOL);
|
||||||
const defaultIp = util.getValue('Default Gateway', lines, ':');
|
let defaultIp = '';
|
||||||
for (let dev in ifaces) {
|
lines.forEach(line => {
|
||||||
if (ifaces.hasOwnProperty(dev)) {
|
line = line.replace(/\s+/g, ' ').trim();
|
||||||
ifaces[dev].forEach(function (details) {
|
if (line.indexOf('0.0.0.0 0.0.0.0') > -1 && !(/[a-zA-Z]/.test(line))) {
|
||||||
if (details && details.address && details.address === defaultIp) {
|
const parts = line.split(' ');
|
||||||
ifacename = dev;
|
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) {
|
||||||
|
if (details && details.address && details.address === defaultIp) {
|
||||||
|
ifacename = dev;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -330,7 +341,7 @@ function networkInterfaces(callback) {
|
|||||||
ip6: nic.ip6,
|
ip6: nic.ip6,
|
||||||
mac: nic.mac,
|
mac: nic.mac,
|
||||||
internal: nic.internal,
|
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,
|
operstate: nic.operstate,
|
||||||
type: nic.type,
|
type: nic.type,
|
||||||
duplex: nic.duplex,
|
duplex: nic.duplex,
|
||||||
@ -432,12 +443,6 @@ function networkInterfaces(callback) {
|
|||||||
operstate = util.getValue(lines, 'operstate');
|
operstate = util.getValue(lines, 'operstate');
|
||||||
type = operstate === 'up' ? (util.getValue(lines, 'wireless').trim() ? 'wireless' : 'wired') : 'unknown';
|
type = operstate === 'up' ? (util.getValue(lines, 'wireless').trim() ? 'wireless' : 'wired') : 'unknown';
|
||||||
if (iface === 'lo' || iface.startsWith('bond')) { type = 'virtual'; }
|
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) {
|
if (_windows) {
|
||||||
nics.forEach(detail => {
|
nics.forEach(detail => {
|
||||||
@ -453,7 +458,7 @@ function networkInterfaces(callback) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
let internal = (ifaces[dev] && ifaces[dev][0]) ? ifaces[dev][0].internal : null;
|
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({
|
result.push({
|
||||||
iface: dev,
|
iface: dev,
|
||||||
ifaceName,
|
ifaceName,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user