systeminformation 6.0.0-beta.23 → 6.0.0-beta.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -5
- package/dist/bsd/index.d.ts +2 -0
- package/dist/bsd/index.js +5 -1
- package/dist/common/const.d.ts +2 -0
- package/dist/common/const.js +8 -3
- package/dist/common/defaults.js +15 -4
- package/dist/common/disk-speed.d.ts +20 -0
- package/dist/common/disk-speed.js +142 -0
- package/dist/common/exec.d.ts +5 -2
- package/dist/common/exec.js +6 -3
- package/dist/common/filesys.d.ts +1 -1
- package/dist/common/filesys.js +24 -4
- package/dist/common/mappings.d.ts +1 -1
- package/dist/common/mappings.js +14 -4
- package/dist/common/types.d.ts +32 -0
- package/dist/common/windows.d.ts +1 -0
- package/dist/common/windows.js +21 -7
- package/dist/cpu-current-load.js +45 -0
- package/dist/cpu-current-speed.js +6 -0
- package/dist/darwin/cpu-current-speed.d.ts +2 -0
- package/dist/darwin/cpu-current-speed.js +30 -0
- package/dist/darwin/cpu-temperature.js +7 -13
- package/dist/darwin/disk-speed.d.ts +2 -0
- package/dist/darwin/disk-speed.js +18 -0
- package/dist/darwin/disks-io.js +3 -1
- package/dist/darwin/fans.js +11 -13
- package/dist/darwin/gpu.d.ts +1 -1
- package/dist/darwin/gpu.js +4 -4
- package/dist/darwin/index.d.ts +2 -0
- package/dist/darwin/index.js +6 -2
- package/dist/darwin/network-interfaces.js +14 -4
- package/dist/darwin/network-routes.d.ts +3 -0
- package/dist/darwin/network-routes.js +74 -0
- package/dist/disk-speed.d.ts +1 -0
- package/dist/disk-speed.js +17 -0
- package/dist/get.js +5 -5
- package/dist/index.d.ts +11 -8
- package/dist/index.js +28 -21
- package/dist/linux/block-devices.d.ts +1 -1
- package/dist/linux/block-devices.js +21 -5
- package/dist/linux/cpu-topology.d.ts +2 -0
- package/dist/linux/cpu-topology.js +15 -0
- package/dist/linux/disk-speed.d.ts +2 -0
- package/dist/linux/disk-speed.js +16 -0
- package/dist/linux/disks-io.d.ts +1 -1
- package/dist/linux/disks-io.js +18 -7
- package/dist/linux/index.d.ts +2 -0
- package/dist/linux/index.js +6 -2
- package/dist/linux/mem.js +20 -1
- package/dist/linux/network-interfaces.js +18 -7
- package/dist/linux/network-routes.d.ts +4 -0
- package/dist/linux/network-routes.js +69 -0
- package/dist/linux/os-info.js +32 -4
- package/dist/linux/pci.d.ts +1 -1
- package/dist/linux/pci.js +4 -3
- package/dist/network-routes.d.ts +1 -0
- package/dist/network-routes.js +17 -0
- package/dist/powershell.d.ts +2 -0
- package/dist/powershell.js +15 -0
- package/dist/windows/block-devices.js +6 -1
- package/dist/windows/cpu-topology.d.ts +3 -0
- package/dist/windows/cpu-topology.js +90 -0
- package/dist/windows/disk-speed.d.ts +6 -0
- package/dist/windows/disk-speed.js +73 -0
- package/dist/windows/disks-io.js +3 -1
- package/dist/windows/index.d.ts +2 -0
- package/dist/windows/index.js +6 -2
- package/dist/windows/network-interfaces.js +6 -3
- package/dist/windows/network-routes.d.ts +3 -0
- package/dist/windows/network-routes.js +41 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,21 +8,22 @@ export { camera } from './camera';
|
|
|
8
8
|
export { chassis } from './chassis';
|
|
9
9
|
export { cpu } from './cpu';
|
|
10
10
|
export { cpuCache } from './cpu-cache';
|
|
11
|
+
export { currentLoad } from './cpu-current-load';
|
|
11
12
|
export { cpuCurrentSpeed } from './cpu-current-speed';
|
|
12
13
|
export { cpuFlags } from './cpu-flags';
|
|
14
|
+
export { fullLoad } from './cpu-full-load';
|
|
13
15
|
export { cpuTemperature } from './cpu-temperature';
|
|
14
|
-
export { fans } from './fans';
|
|
15
|
-
export { currentLoad } from './cpu-current-load';
|
|
16
16
|
export { diskLayout } from './disk-layout';
|
|
17
|
+
export { diskSpeed } from './disk-speed';
|
|
17
18
|
export { disksIO } from './disks-io';
|
|
18
19
|
export { displays } from './displays';
|
|
19
|
-
export {
|
|
20
|
+
export { dockerAll, dockerContainerProcesses, dockerContainerStats, dockerContainers, dockerImages, dockerInfo, dockerVolumes } from './docker';
|
|
21
|
+
export { fans } from './fans';
|
|
20
22
|
export { fsOpenFiles } from './fs-open-files';
|
|
21
23
|
export { fsSize } from './fs-size';
|
|
22
24
|
export { fsStats } from './fs-stats';
|
|
23
|
-
export { fullLoad } from './cpu-full-load';
|
|
24
25
|
export { get } from './get';
|
|
25
|
-
export {
|
|
26
|
+
export { getAllData, getDynamicData, getStaticData } from './get-data';
|
|
26
27
|
export { gpu } from './gpu';
|
|
27
28
|
export { inetChecksite } from './inet-checksite';
|
|
28
29
|
export { inetLatency } from './inet-latency';
|
|
@@ -35,16 +36,18 @@ export { networkConnections } from './network-connections';
|
|
|
35
36
|
export { networkGatewayDefault } from './network-gateway-default';
|
|
36
37
|
export { networkInterfaceDefault } from './network-interface-default';
|
|
37
38
|
export { networkInterfaces } from './network-interfaces';
|
|
39
|
+
export { networkRoutes } from './network-routes';
|
|
38
40
|
export { networkStats } from './network-stats';
|
|
39
41
|
export { npm } from './npm';
|
|
40
42
|
export { npu } from './npu';
|
|
41
43
|
export { observe } from './observe';
|
|
42
44
|
export { osInfo } from './os-info';
|
|
43
45
|
export { pci } from './pci';
|
|
46
|
+
export { powerShellRelease, powerShellStart } from './powershell';
|
|
44
47
|
export { printer } from './printer';
|
|
45
|
-
export { processes } from './processes';
|
|
46
|
-
export { processLoad } from './process-load';
|
|
47
48
|
export { processFocused } from './process-focused';
|
|
49
|
+
export { processLoad } from './process-load';
|
|
50
|
+
export { processes } from './processes';
|
|
48
51
|
export { serialPorts } from './serial-ports';
|
|
49
52
|
export { services } from './services';
|
|
50
53
|
export { shell } from './shell';
|
|
@@ -55,9 +58,9 @@ export { time } from './time';
|
|
|
55
58
|
export { usb } from './usb';
|
|
56
59
|
export { users } from './users';
|
|
57
60
|
export { uuid } from './uuid';
|
|
58
|
-
export { vboxInfo } from './virtualbox';
|
|
59
61
|
export { version } from './version';
|
|
60
62
|
export { versions } from './versions';
|
|
63
|
+
export { vboxInfo } from './virtualbox';
|
|
61
64
|
export { wifiConnections } from './wifi-connections';
|
|
62
65
|
export { wifiInterfaces } from './wifi-interfaces';
|
|
63
66
|
export { wifiNetworks } from './wifi-networks';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.
|
|
3
|
+
exports.npu = exports.npm = exports.networkStats = exports.networkRoutes = exports.networkInterfaces = exports.networkInterfaceDefault = exports.networkGatewayDefault = exports.networkConnections = exports.mouse = exports.memLayout = exports.mem = exports.keyboard = exports.inetPublicIp = exports.inetLatency = exports.inetChecksite = exports.gpu = exports.getStaticData = exports.getDynamicData = exports.getAllData = exports.get = exports.fsStats = exports.fsSize = exports.fsOpenFiles = exports.fans = exports.dockerVolumes = exports.dockerInfo = exports.dockerImages = exports.dockerContainers = exports.dockerContainerStats = exports.dockerContainerProcesses = exports.dockerAll = exports.displays = exports.disksIO = exports.diskSpeed = exports.diskLayout = exports.cpuTemperature = exports.fullLoad = exports.cpuFlags = exports.cpuCurrentSpeed = exports.currentLoad = exports.cpuCache = exports.cpu = exports.chassis = exports.camera = exports.bluetoothDevices = exports.blockDevices = exports.bios = exports.battery = exports.baseboard = exports.audio = void 0;
|
|
4
|
+
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.vboxInfo = exports.versions = exports.version = exports.uuid = exports.users = exports.usb = exports.time = exports.thunderbolt = exports.system = exports.software = exports.shell = exports.services = exports.serialPorts = exports.processes = exports.processLoad = exports.processFocused = exports.printer = exports.powerShellStart = exports.powerShellRelease = exports.pci = exports.osInfo = exports.observe = void 0;
|
|
5
5
|
var audio_1 = require("./audio");
|
|
6
6
|
Object.defineProperty(exports, "audio", { enumerable: true, get: function () { return audio_1.audio; } });
|
|
7
7
|
var baseboard_1 = require("./baseboard");
|
|
@@ -22,44 +22,46 @@ var cpu_1 = require("./cpu");
|
|
|
22
22
|
Object.defineProperty(exports, "cpu", { enumerable: true, get: function () { return cpu_1.cpu; } });
|
|
23
23
|
var cpu_cache_1 = require("./cpu-cache");
|
|
24
24
|
Object.defineProperty(exports, "cpuCache", { enumerable: true, get: function () { return cpu_cache_1.cpuCache; } });
|
|
25
|
+
var cpu_current_load_1 = require("./cpu-current-load");
|
|
26
|
+
Object.defineProperty(exports, "currentLoad", { enumerable: true, get: function () { return cpu_current_load_1.currentLoad; } });
|
|
25
27
|
var cpu_current_speed_1 = require("./cpu-current-speed");
|
|
26
28
|
Object.defineProperty(exports, "cpuCurrentSpeed", { enumerable: true, get: function () { return cpu_current_speed_1.cpuCurrentSpeed; } });
|
|
27
29
|
var cpu_flags_1 = require("./cpu-flags");
|
|
28
30
|
Object.defineProperty(exports, "cpuFlags", { enumerable: true, get: function () { return cpu_flags_1.cpuFlags; } });
|
|
31
|
+
var cpu_full_load_1 = require("./cpu-full-load");
|
|
32
|
+
Object.defineProperty(exports, "fullLoad", { enumerable: true, get: function () { return cpu_full_load_1.fullLoad; } });
|
|
29
33
|
var cpu_temperature_1 = require("./cpu-temperature");
|
|
30
34
|
Object.defineProperty(exports, "cpuTemperature", { enumerable: true, get: function () { return cpu_temperature_1.cpuTemperature; } });
|
|
31
|
-
var fans_1 = require("./fans");
|
|
32
|
-
Object.defineProperty(exports, "fans", { enumerable: true, get: function () { return fans_1.fans; } });
|
|
33
|
-
var cpu_current_load_1 = require("./cpu-current-load");
|
|
34
|
-
Object.defineProperty(exports, "currentLoad", { enumerable: true, get: function () { return cpu_current_load_1.currentLoad; } });
|
|
35
35
|
var disk_layout_1 = require("./disk-layout");
|
|
36
36
|
Object.defineProperty(exports, "diskLayout", { enumerable: true, get: function () { return disk_layout_1.diskLayout; } });
|
|
37
|
+
var disk_speed_1 = require("./disk-speed");
|
|
38
|
+
Object.defineProperty(exports, "diskSpeed", { enumerable: true, get: function () { return disk_speed_1.diskSpeed; } });
|
|
37
39
|
var disks_io_1 = require("./disks-io");
|
|
38
40
|
Object.defineProperty(exports, "disksIO", { enumerable: true, get: function () { return disks_io_1.disksIO; } });
|
|
39
41
|
var displays_1 = require("./displays");
|
|
40
42
|
Object.defineProperty(exports, "displays", { enumerable: true, get: function () { return displays_1.displays; } });
|
|
41
43
|
var docker_1 = require("./docker");
|
|
42
|
-
Object.defineProperty(exports, "
|
|
43
|
-
Object.defineProperty(exports, "dockerImages", { enumerable: true, get: function () { return docker_1.dockerImages; } });
|
|
44
|
-
Object.defineProperty(exports, "dockerContainers", { enumerable: true, get: function () { return docker_1.dockerContainers; } });
|
|
45
|
-
Object.defineProperty(exports, "dockerContainerStats", { enumerable: true, get: function () { return docker_1.dockerContainerStats; } });
|
|
44
|
+
Object.defineProperty(exports, "dockerAll", { enumerable: true, get: function () { return docker_1.dockerAll; } });
|
|
46
45
|
Object.defineProperty(exports, "dockerContainerProcesses", { enumerable: true, get: function () { return docker_1.dockerContainerProcesses; } });
|
|
46
|
+
Object.defineProperty(exports, "dockerContainerStats", { enumerable: true, get: function () { return docker_1.dockerContainerStats; } });
|
|
47
|
+
Object.defineProperty(exports, "dockerContainers", { enumerable: true, get: function () { return docker_1.dockerContainers; } });
|
|
48
|
+
Object.defineProperty(exports, "dockerImages", { enumerable: true, get: function () { return docker_1.dockerImages; } });
|
|
49
|
+
Object.defineProperty(exports, "dockerInfo", { enumerable: true, get: function () { return docker_1.dockerInfo; } });
|
|
47
50
|
Object.defineProperty(exports, "dockerVolumes", { enumerable: true, get: function () { return docker_1.dockerVolumes; } });
|
|
48
|
-
|
|
51
|
+
var fans_1 = require("./fans");
|
|
52
|
+
Object.defineProperty(exports, "fans", { enumerable: true, get: function () { return fans_1.fans; } });
|
|
49
53
|
var fs_open_files_1 = require("./fs-open-files");
|
|
50
54
|
Object.defineProperty(exports, "fsOpenFiles", { enumerable: true, get: function () { return fs_open_files_1.fsOpenFiles; } });
|
|
51
55
|
var fs_size_1 = require("./fs-size");
|
|
52
56
|
Object.defineProperty(exports, "fsSize", { enumerable: true, get: function () { return fs_size_1.fsSize; } });
|
|
53
57
|
var fs_stats_1 = require("./fs-stats");
|
|
54
58
|
Object.defineProperty(exports, "fsStats", { enumerable: true, get: function () { return fs_stats_1.fsStats; } });
|
|
55
|
-
var cpu_full_load_1 = require("./cpu-full-load");
|
|
56
|
-
Object.defineProperty(exports, "fullLoad", { enumerable: true, get: function () { return cpu_full_load_1.fullLoad; } });
|
|
57
59
|
var get_1 = require("./get");
|
|
58
60
|
Object.defineProperty(exports, "get", { enumerable: true, get: function () { return get_1.get; } });
|
|
59
61
|
var get_data_1 = require("./get-data");
|
|
60
|
-
Object.defineProperty(exports, "getStaticData", { enumerable: true, get: function () { return get_data_1.getStaticData; } });
|
|
61
|
-
Object.defineProperty(exports, "getDynamicData", { enumerable: true, get: function () { return get_data_1.getDynamicData; } });
|
|
62
62
|
Object.defineProperty(exports, "getAllData", { enumerable: true, get: function () { return get_data_1.getAllData; } });
|
|
63
|
+
Object.defineProperty(exports, "getDynamicData", { enumerable: true, get: function () { return get_data_1.getDynamicData; } });
|
|
64
|
+
Object.defineProperty(exports, "getStaticData", { enumerable: true, get: function () { return get_data_1.getStaticData; } });
|
|
63
65
|
var gpu_1 = require("./gpu");
|
|
64
66
|
Object.defineProperty(exports, "gpu", { enumerable: true, get: function () { return gpu_1.gpu; } });
|
|
65
67
|
var inet_checksite_1 = require("./inet-checksite");
|
|
@@ -84,6 +86,8 @@ var network_interface_default_1 = require("./network-interface-default");
|
|
|
84
86
|
Object.defineProperty(exports, "networkInterfaceDefault", { enumerable: true, get: function () { return network_interface_default_1.networkInterfaceDefault; } });
|
|
85
87
|
var network_interfaces_1 = require("./network-interfaces");
|
|
86
88
|
Object.defineProperty(exports, "networkInterfaces", { enumerable: true, get: function () { return network_interfaces_1.networkInterfaces; } });
|
|
89
|
+
var network_routes_1 = require("./network-routes");
|
|
90
|
+
Object.defineProperty(exports, "networkRoutes", { enumerable: true, get: function () { return network_routes_1.networkRoutes; } });
|
|
87
91
|
var network_stats_1 = require("./network-stats");
|
|
88
92
|
Object.defineProperty(exports, "networkStats", { enumerable: true, get: function () { return network_stats_1.networkStats; } });
|
|
89
93
|
var npm_1 = require("./npm");
|
|
@@ -96,14 +100,17 @@ var os_info_1 = require("./os-info");
|
|
|
96
100
|
Object.defineProperty(exports, "osInfo", { enumerable: true, get: function () { return os_info_1.osInfo; } });
|
|
97
101
|
var pci_1 = require("./pci");
|
|
98
102
|
Object.defineProperty(exports, "pci", { enumerable: true, get: function () { return pci_1.pci; } });
|
|
103
|
+
var powershell_1 = require("./powershell");
|
|
104
|
+
Object.defineProperty(exports, "powerShellRelease", { enumerable: true, get: function () { return powershell_1.powerShellRelease; } });
|
|
105
|
+
Object.defineProperty(exports, "powerShellStart", { enumerable: true, get: function () { return powershell_1.powerShellStart; } });
|
|
99
106
|
var printer_1 = require("./printer");
|
|
100
107
|
Object.defineProperty(exports, "printer", { enumerable: true, get: function () { return printer_1.printer; } });
|
|
101
|
-
var processes_1 = require("./processes");
|
|
102
|
-
Object.defineProperty(exports, "processes", { enumerable: true, get: function () { return processes_1.processes; } });
|
|
103
|
-
var process_load_1 = require("./process-load");
|
|
104
|
-
Object.defineProperty(exports, "processLoad", { enumerable: true, get: function () { return process_load_1.processLoad; } });
|
|
105
108
|
var process_focused_1 = require("./process-focused");
|
|
106
109
|
Object.defineProperty(exports, "processFocused", { enumerable: true, get: function () { return process_focused_1.processFocused; } });
|
|
110
|
+
var process_load_1 = require("./process-load");
|
|
111
|
+
Object.defineProperty(exports, "processLoad", { enumerable: true, get: function () { return process_load_1.processLoad; } });
|
|
112
|
+
var processes_1 = require("./processes");
|
|
113
|
+
Object.defineProperty(exports, "processes", { enumerable: true, get: function () { return processes_1.processes; } });
|
|
107
114
|
var serial_ports_1 = require("./serial-ports");
|
|
108
115
|
Object.defineProperty(exports, "serialPorts", { enumerable: true, get: function () { return serial_ports_1.serialPorts; } });
|
|
109
116
|
var services_1 = require("./services");
|
|
@@ -124,12 +131,12 @@ var users_1 = require("./users");
|
|
|
124
131
|
Object.defineProperty(exports, "users", { enumerable: true, get: function () { return users_1.users; } });
|
|
125
132
|
var uuid_1 = require("./uuid");
|
|
126
133
|
Object.defineProperty(exports, "uuid", { enumerable: true, get: function () { return uuid_1.uuid; } });
|
|
127
|
-
var virtualbox_1 = require("./virtualbox");
|
|
128
|
-
Object.defineProperty(exports, "vboxInfo", { enumerable: true, get: function () { return virtualbox_1.vboxInfo; } });
|
|
129
134
|
var version_1 = require("./version");
|
|
130
135
|
Object.defineProperty(exports, "version", { enumerable: true, get: function () { return version_1.version; } });
|
|
131
136
|
var versions_1 = require("./versions");
|
|
132
137
|
Object.defineProperty(exports, "versions", { enumerable: true, get: function () { return versions_1.versions; } });
|
|
138
|
+
var virtualbox_1 = require("./virtualbox");
|
|
139
|
+
Object.defineProperty(exports, "vboxInfo", { enumerable: true, get: function () { return virtualbox_1.vboxInfo; } });
|
|
133
140
|
var wifi_connections_1 = require("./wifi-connections");
|
|
134
141
|
Object.defineProperty(exports, "wifiConnections", { enumerable: true, get: function () { return wifi_connections_1.wifiConnections; } });
|
|
135
142
|
var wifi_interfaces_1 = require("./wifi-interfaces");
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FsBlockDevicesData } from '../common/types';
|
|
1
|
+
import type { FsBlockDevicesData } from '../common/types';
|
|
2
2
|
export declare const blockDevices: () => Promise<FsBlockDevicesData[]>;
|
|
@@ -1,28 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.blockDevices = void 0;
|
|
4
|
-
const exec_1 = require("../common/exec");
|
|
5
4
|
const common_1 = require("../common");
|
|
6
|
-
const filesys_1 = require("../common/filesys");
|
|
7
5
|
const const_1 = require("../common/const");
|
|
6
|
+
const exec_1 = require("../common/exec");
|
|
7
|
+
const files_1 = require("../common/files");
|
|
8
|
+
const filesys_1 = require("../common/filesys");
|
|
9
|
+
const security_1 = require("../common/security");
|
|
8
10
|
const poolMatchLinux = async (data) => (0, filesys_1.applyPoolsLinux)(data, [...(await (0, filesys_1.zfsPoolsLinux)(data)), ...(await (0, filesys_1.btrfsPoolsLinux)(data))]);
|
|
11
|
+
const partStartLinux = async (data) => {
|
|
12
|
+
await Promise.all(data
|
|
13
|
+
.filter((item) => item.type === 'part' && (0, security_1.isSafePathSegment)(item.name))
|
|
14
|
+
.map(async (item) => {
|
|
15
|
+
const start = await (0, files_1.readSysfs)(`/sys/class/block/${item.name}/start`);
|
|
16
|
+
item.partStart = start ? (0, common_1.toInt)(start) * 512 : null;
|
|
17
|
+
}));
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
9
20
|
const blockDevices = async () => {
|
|
10
21
|
await (0, common_1.nextTick)();
|
|
11
22
|
let stdout = '';
|
|
12
23
|
try {
|
|
13
|
-
|
|
24
|
+
try {
|
|
25
|
+
({ stdout } = await (0, exec_1.exec)('lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,TRAN,SERIAL,LABEL,MODEL,OWNER,PARTUUID,PARTLABEL,PARTTYPE,PARTFLAGS 2>/dev/null', const_1.execOptsLinux));
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
({ stdout } = await (0, exec_1.exec)('lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,TRAN,SERIAL,LABEL,MODEL,OWNER 2>/dev/null', const_1.execOptsLinux));
|
|
29
|
+
}
|
|
14
30
|
const lines = (0, filesys_1.blkStdoutToObject)(stdout).split('\n');
|
|
15
31
|
let data = (0, filesys_1.parseLinuxBlk)(lines);
|
|
16
32
|
data = await (0, filesys_1.raidMatchLinux)(data);
|
|
17
33
|
data = await poolMatchLinux(data);
|
|
18
|
-
return (0, filesys_1.matchDevicesLinux)(data);
|
|
34
|
+
return partStartLinux((0, filesys_1.matchDevicesLinux)(data));
|
|
19
35
|
}
|
|
20
36
|
catch {
|
|
21
37
|
try {
|
|
22
38
|
({ stdout } = await (0, exec_1.exec)('lsblk -bPo NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,UUID,ROTA,RO,RM,LABEL,MODEL,OWNER 2>/dev/null', const_1.execOptsLinux));
|
|
23
39
|
const lines = (0, filesys_1.blkStdoutToObject)(stdout).split('\n');
|
|
24
40
|
const data = (0, filesys_1.parseLinuxBlk)(lines);
|
|
25
|
-
return await poolMatchLinux(await (0, filesys_1.raidMatchLinux)(data));
|
|
41
|
+
return partStartLinux(await poolMatchLinux(await (0, filesys_1.raidMatchLinux)(data)));
|
|
26
42
|
}
|
|
27
43
|
catch {
|
|
28
44
|
return [];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cpuTopology = void 0;
|
|
4
|
+
const common_1 = require("../common");
|
|
5
|
+
const files_1 = require("../common/files");
|
|
6
|
+
const toId = (value) => (/^\d+$/.test(value.trim()) ? (0, common_1.toInt)(value) : null);
|
|
7
|
+
const cpuTopology = async () => {
|
|
8
|
+
const names = (await (0, files_1.readFileLines)('/proc/stat')).map((line) => line.split(' ')[0] || '').filter((name) => /^cpu\d+$/.test(name));
|
|
9
|
+
return Promise.all(names.map(async (name) => {
|
|
10
|
+
const dir = `/sys/devices/system/cpu/${name}/topology`;
|
|
11
|
+
const [coreId, socketId] = await Promise.all([(0, files_1.readSysfs)(`${dir}/core_id`), (0, files_1.readSysfs)(`${dir}/physical_package_id`)]);
|
|
12
|
+
return { coreId: toId(coreId), socketId: toId(socketId) };
|
|
13
|
+
}));
|
|
14
|
+
};
|
|
15
|
+
exports.cpuTopology = cpuTopology;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.diskSpeed = void 0;
|
|
4
|
+
const disk_speed_1 = require("../common/disk-speed");
|
|
5
|
+
const exec_1 = require("../common/exec");
|
|
6
|
+
const readUncached = async (file, bytes) => {
|
|
7
|
+
try {
|
|
8
|
+
await (0, exec_1.execFile)('dd', [`if=${file}`, 'iflag=nocache', 'count=0'], { timeout: 10000 });
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return (0, disk_speed_1.readFileTimed)(file, bytes);
|
|
14
|
+
};
|
|
15
|
+
const diskSpeed = (path, sizeMB) => (0, disk_speed_1.runDiskSpeed)(path, sizeMB, { readUncached });
|
|
16
|
+
exports.diskSpeed = diskSpeed;
|
package/dist/linux/disks-io.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DisksIoData } from '../common/types';
|
|
1
|
+
import type { DisksIoData } from '../common/types';
|
|
2
2
|
export declare const disksIO: () => Promise<DisksIoData>;
|
package/dist/linux/disks-io.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.disksIO = void 0;
|
|
4
|
-
const defaults_1 = require("../common/defaults");
|
|
5
|
-
const index_1 = require("../common/index");
|
|
6
|
-
const common_1 = require("../common");
|
|
7
|
-
const filesys_1 = require("../common/filesys");
|
|
8
4
|
const promises_1 = require("node:fs/promises");
|
|
5
|
+
const common_1 = require("../common");
|
|
6
|
+
const defaults_1 = require("../common/defaults");
|
|
9
7
|
const files_1 = require("../common/files");
|
|
8
|
+
const filesys_1 = require("../common/filesys");
|
|
9
|
+
const index_1 = require("../common/index");
|
|
10
10
|
const security_1 = require("../common/security");
|
|
11
|
+
let _diskCount = -1;
|
|
11
12
|
const disksIO = async () => {
|
|
12
13
|
await (0, common_1.nextTick)();
|
|
13
14
|
if ((filesys_1._disk_io && !filesys_1._disk_io.ms) || (filesys_1._disk_io && filesys_1._disk_io.ms && Date.now() - filesys_1._disk_io.ms >= 500)) {
|
|
@@ -17,10 +18,12 @@ const disksIO = async () => {
|
|
|
17
18
|
let rWaitTime = 0;
|
|
18
19
|
let wWaitTime = 0;
|
|
19
20
|
let tWaitTime = 0;
|
|
21
|
+
let busyTime = 0;
|
|
22
|
+
let diskCount = 0;
|
|
20
23
|
try {
|
|
21
24
|
const disks = (await (0, promises_1.readdir)('/sys/block')).filter((dev) => !/^(loop|ram|zram|dm-|md|sr|fd|nbd|zd)/.test(dev) && (0, security_1.isSafePathSegment)(dev));
|
|
22
25
|
const lines = await Promise.all(disks.map((dev) => (0, files_1.readSysfs)(`/sys/block/${dev}/stat`)));
|
|
23
|
-
lines.forEach(
|
|
26
|
+
lines.forEach((line) => {
|
|
24
27
|
if (!line) {
|
|
25
28
|
return;
|
|
26
29
|
}
|
|
@@ -30,8 +33,14 @@ const disksIO = async () => {
|
|
|
30
33
|
rWaitTime += (0, common_1.toInt)(stats[3]);
|
|
31
34
|
wWaitTime += (0, common_1.toInt)(stats[7]);
|
|
32
35
|
tWaitTime += (0, common_1.toInt)(stats[10]);
|
|
36
|
+
busyTime += (0, common_1.toInt)(stats[9]);
|
|
37
|
+
diskCount++;
|
|
33
38
|
});
|
|
34
|
-
|
|
39
|
+
if (diskCount !== _diskCount) {
|
|
40
|
+
filesys_1._disk_io.busyTime = null;
|
|
41
|
+
_diskCount = diskCount;
|
|
42
|
+
}
|
|
43
|
+
return (0, filesys_1.calcDiskIO)(rIO, wIO, rWaitTime, wWaitTime, tWaitTime, diskCount ? busyTime / diskCount : null);
|
|
35
44
|
}
|
|
36
45
|
catch {
|
|
37
46
|
return defaults;
|
|
@@ -51,7 +60,9 @@ const disksIO = async () => {
|
|
|
51
60
|
tWaitTime: filesys_1._disk_io.tWaitTimeDelta,
|
|
52
61
|
rWaitPercent: filesys_1._disk_io.rWaitPercent,
|
|
53
62
|
wWaitPercent: filesys_1._disk_io.wWaitPercent,
|
|
54
|
-
tWaitPercent: filesys_1._disk_io.tWaitPercent
|
|
63
|
+
tWaitPercent: filesys_1._disk_io.tWaitPercent,
|
|
64
|
+
busyPercent: filesys_1._disk_io.busyPercent,
|
|
65
|
+
idlePercent: filesys_1._disk_io.idlePercent
|
|
55
66
|
};
|
|
56
67
|
}
|
|
57
68
|
};
|
package/dist/linux/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { cpuTemperature } from './cpu-temperature';
|
|
|
14
14
|
export { fans } from './fans';
|
|
15
15
|
export { currentLoad } from '../cpu-current-load';
|
|
16
16
|
export { diskLayout } from './disk-layout';
|
|
17
|
+
export { diskSpeed } from './disk-speed';
|
|
17
18
|
export { disksIO } from './disks-io';
|
|
18
19
|
export { displays } from './displays';
|
|
19
20
|
export { dockerInfo, dockerImages, dockerContainers, dockerContainerStats, dockerContainerProcesses, dockerVolumes, dockerAll } from '../docker';
|
|
@@ -32,6 +33,7 @@ export { networkConnections } from './network-connections';
|
|
|
32
33
|
export { networkGatewayDefault } from './network-gateway-default';
|
|
33
34
|
export { networkInterfaceDefault } from './network-interface-default';
|
|
34
35
|
export { networkInterfaces } from './network-interfaces';
|
|
36
|
+
export { networkRoutes } from './network-routes';
|
|
35
37
|
export { networkStats } from './network-stats';
|
|
36
38
|
export { npm } from './npm';
|
|
37
39
|
export { npu } from './npu';
|
package/dist/linux/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.versions = exports.version = exports.vboxInfo = exports.uuid = exports.users = exports.usb = exports.serialPorts = exports.time = exports.thunderbolt = exports.system = exports.software = exports.shell = void 0;
|
|
3
|
+
exports.processLoad = exports.processes = exports.printer = exports.pci = exports.osInfo = exports.npu = exports.npm = exports.networkStats = exports.networkRoutes = exports.networkInterfaces = exports.networkInterfaceDefault = exports.networkGatewayDefault = exports.networkConnections = exports.mouse = exports.memLayout = exports.mem = exports.keyboard = exports.inetLatency = exports.inetChecksite = exports.gpu = exports.fullLoad = exports.fsStats = exports.fsSize = exports.fsOpenFiles = exports.dockerAll = exports.dockerVolumes = exports.dockerContainerProcesses = exports.dockerContainerStats = exports.dockerContainers = exports.dockerImages = exports.dockerInfo = exports.displays = exports.disksIO = exports.diskSpeed = exports.diskLayout = exports.currentLoad = exports.fans = exports.cpuTemperature = exports.cpuFlags = exports.cpuCurrentSpeed = exports.cpuCache = exports.cpu = exports.chassis = exports.camera = exports.bluetoothDevices = exports.blockDevices = exports.bios = exports.battery = exports.baseboard = exports.audio = void 0;
|
|
4
|
+
exports.wifiNetworks = exports.wifiInterfaces = exports.wifiConnections = exports.versions = exports.version = exports.vboxInfo = exports.uuid = exports.users = exports.usb = exports.serialPorts = exports.time = exports.thunderbolt = exports.system = exports.software = exports.shell = exports.services = exports.processFocused = void 0;
|
|
5
5
|
var audio_1 = require("./audio");
|
|
6
6
|
Object.defineProperty(exports, "audio", { enumerable: true, get: function () { return audio_1.audio; } });
|
|
7
7
|
var baseboard_1 = require("./baseboard");
|
|
@@ -34,6 +34,8 @@ var cpu_current_load_1 = require("../cpu-current-load");
|
|
|
34
34
|
Object.defineProperty(exports, "currentLoad", { enumerable: true, get: function () { return cpu_current_load_1.currentLoad; } });
|
|
35
35
|
var disk_layout_1 = require("./disk-layout");
|
|
36
36
|
Object.defineProperty(exports, "diskLayout", { enumerable: true, get: function () { return disk_layout_1.diskLayout; } });
|
|
37
|
+
var disk_speed_1 = require("./disk-speed");
|
|
38
|
+
Object.defineProperty(exports, "diskSpeed", { enumerable: true, get: function () { return disk_speed_1.diskSpeed; } });
|
|
37
39
|
var disks_io_1 = require("./disks-io");
|
|
38
40
|
Object.defineProperty(exports, "disksIO", { enumerable: true, get: function () { return disks_io_1.disksIO; } });
|
|
39
41
|
var displays_1 = require("./displays");
|
|
@@ -76,6 +78,8 @@ var network_interface_default_1 = require("./network-interface-default");
|
|
|
76
78
|
Object.defineProperty(exports, "networkInterfaceDefault", { enumerable: true, get: function () { return network_interface_default_1.networkInterfaceDefault; } });
|
|
77
79
|
var network_interfaces_1 = require("./network-interfaces");
|
|
78
80
|
Object.defineProperty(exports, "networkInterfaces", { enumerable: true, get: function () { return network_interfaces_1.networkInterfaces; } });
|
|
81
|
+
var network_routes_1 = require("./network-routes");
|
|
82
|
+
Object.defineProperty(exports, "networkRoutes", { enumerable: true, get: function () { return network_routes_1.networkRoutes; } });
|
|
79
83
|
var network_stats_1 = require("./network-stats");
|
|
80
84
|
Object.defineProperty(exports, "networkStats", { enumerable: true, get: function () { return network_stats_1.networkStats; } });
|
|
81
85
|
var npm_1 = require("./npm");
|
package/dist/linux/mem.js
CHANGED
|
@@ -24,6 +24,24 @@ const parseArcstats = (lines) => {
|
|
|
24
24
|
return Math.max(size - cMin, 0);
|
|
25
25
|
};
|
|
26
26
|
exports.parseArcstats = parseArcstats;
|
|
27
|
+
const _swap = { pswpin: 0, pswpout: 0, ms: 0, swapin_sec: null, swapout_sec: null };
|
|
28
|
+
const swapActivity = async () => {
|
|
29
|
+
const lines = await (0, files_1.readFileLines)('/proc/vmstat');
|
|
30
|
+
const pswpin = (0, common_1.toInt)((0, common_1.getValue)(lines, 'pswpin', ' '));
|
|
31
|
+
const pswpout = (0, common_1.toInt)((0, common_1.getValue)(lines, 'pswpout', ' '));
|
|
32
|
+
const now = Date.now();
|
|
33
|
+
if (lines.length && _swap.ms && now > _swap.ms) {
|
|
34
|
+
const seconds = (now - _swap.ms) / 1000;
|
|
35
|
+
_swap.swapin_sec = Math.max(0, pswpin - _swap.pswpin) / seconds;
|
|
36
|
+
_swap.swapout_sec = Math.max(0, pswpout - _swap.pswpout) / seconds;
|
|
37
|
+
}
|
|
38
|
+
if (lines.length) {
|
|
39
|
+
_swap.pswpin = pswpin;
|
|
40
|
+
_swap.pswpout = pswpout;
|
|
41
|
+
_swap.ms = now;
|
|
42
|
+
}
|
|
43
|
+
return { swapin_sec: _swap.swapin_sec, swapout_sec: _swap.swapout_sec };
|
|
44
|
+
};
|
|
27
45
|
const mem = async () => {
|
|
28
46
|
await (0, common_1.nextTick)();
|
|
29
47
|
const defaults = (0, common_1.cloneObj)(defaults_1.initMemData);
|
|
@@ -72,7 +90,8 @@ const mem = async () => {
|
|
|
72
90
|
swapused,
|
|
73
91
|
swapfree,
|
|
74
92
|
writeback,
|
|
75
|
-
dirty
|
|
93
|
+
dirty,
|
|
94
|
+
...(await swapActivity())
|
|
76
95
|
};
|
|
77
96
|
}
|
|
78
97
|
catch { }
|
|
@@ -192,7 +192,10 @@ const getLinuxGateways = async () => {
|
|
|
192
192
|
const PCI_SLOT = /^[0-9a-f]{4}:[0-9a-f]{2}:[0-9a-f]{2}\.[0-9a-f]$/i;
|
|
193
193
|
const pciSlotFromPath = (path) => {
|
|
194
194
|
const segments = path.split('/');
|
|
195
|
-
return segments
|
|
195
|
+
return (segments
|
|
196
|
+
.slice(-2)
|
|
197
|
+
.reverse()
|
|
198
|
+
.find((segment) => PCI_SLOT.test(segment)) || null);
|
|
196
199
|
};
|
|
197
200
|
exports.pciSlotFromPath = pciSlotFromPath;
|
|
198
201
|
const _nicHardware = {};
|
|
@@ -241,7 +244,7 @@ const networkInterfaces = async (defaultString = '', rescan = true) => {
|
|
|
241
244
|
return (0, network_1.filterDefaultInterface)(_networkInterfaces, defaultString);
|
|
242
245
|
}
|
|
243
246
|
_interfaces = (0, index_1.cloneObj)(interfaces);
|
|
244
|
-
|
|
247
|
+
const result = [];
|
|
245
248
|
try {
|
|
246
249
|
const [_dhcpNics, defaultInterface, deviceStatus, gateways, sysfsDevices, wirelessLines] = await Promise.all([
|
|
247
250
|
getLinuxDHCPNics(),
|
|
@@ -314,19 +317,25 @@ const networkInterfaces = async (defaultString = '', rescan = true) => {
|
|
|
314
317
|
const ifaceSanitized = (0, security_1.sanitizeString)(ifaceDevName, true);
|
|
315
318
|
let lines = [];
|
|
316
319
|
let hasDevice = true;
|
|
320
|
+
let bridgeMembers = [];
|
|
317
321
|
try {
|
|
318
322
|
const safe = (0, security_1.isSafePathSegment)(ifaceSanitized);
|
|
319
323
|
const connectionName = getLinuxIfaceConnectionName(deviceStatus, ifaceSanitized);
|
|
320
|
-
const [sysfsLines, iwOut, details, device] = await Promise.all([
|
|
324
|
+
const [sysfsLines, iwOut, details, device, brif] = await Promise.all([
|
|
321
325
|
safe ? (0, files_1.readSysfsMany)(`/sys/class/net/${ifaceSanitized}`, ['address', 'carrier_changes', 'duplex', 'mtu', 'operstate', 'speed', 'type']) : [],
|
|
322
326
|
safe ? (0, files_1.fileExists)(`/sys/class/net/${ifaceSanitized}/phy80211`).then((wifi) => (wifi ? (0, exec_1.execSecure)('iw', ['dev', ifaceSanitized, 'link'], EXEC_OPTS) : '')) : '',
|
|
323
327
|
getLinuxConnectionDetails(connectionName),
|
|
324
|
-
safe ? (0, files_1.fileExists)(`/sys/class/net/${ifaceSanitized}/device`) : true
|
|
328
|
+
safe ? (0, files_1.fileExists)(`/sys/class/net/${ifaceSanitized}/device`) : true,
|
|
329
|
+
safe ? (0, promises_1.readdir)(`/sys/class/net/${ifaceSanitized}/brif`).catch(() => []) : []
|
|
325
330
|
]);
|
|
326
331
|
hasDevice = device;
|
|
332
|
+
bridgeMembers = brif.sort();
|
|
327
333
|
lines = sysfsLines;
|
|
328
334
|
lines.push(`wireless: ${wirelessLines.find((line) => line.indexOf(ifaceSanitized) >= 0) || ''}`);
|
|
329
|
-
lines.push(...iwOut
|
|
335
|
+
lines.push(...iwOut
|
|
336
|
+
.split('\n')
|
|
337
|
+
.filter((line) => line.indexOf('bitrate') >= 0)
|
|
338
|
+
.map((line) => line.trim()));
|
|
330
339
|
dhcp = getLinuxIfaceDHCPstatus(ifaceSanitized, details, _dhcpNics);
|
|
331
340
|
dnsSuffix = getLinuxIfaceDNSsuffix(details);
|
|
332
341
|
ieee8021xAuth = getLinuxIfaceIEEE8021xAuth(details);
|
|
@@ -347,7 +356,8 @@ const networkInterfaces = async (defaultString = '', rescan = true) => {
|
|
|
347
356
|
}
|
|
348
357
|
carrierChanges = (0, common_1.toInt)((0, common_1.getValue)(lines, 'carrier_changes'));
|
|
349
358
|
const operstate = (0, common_1.getValue)(lines, 'operstate');
|
|
350
|
-
|
|
359
|
+
const arphrd = (0, common_1.toInt)((0, common_1.getValue)(lines, 'type'));
|
|
360
|
+
type = (0, common_1.getValue)(lines, 'wireless').trim() ? 'wireless' : arphrd === 1 ? 'wired' : arphrd === 280 ? 'can' : 'unknown';
|
|
351
361
|
if (ifaceSanitized === 'lo' || ifaceSanitized.startsWith('bond')) {
|
|
352
362
|
type = 'virtual';
|
|
353
363
|
}
|
|
@@ -380,7 +390,8 @@ const networkInterfaces = async (defaultString = '', rescan = true) => {
|
|
|
380
390
|
dnsSuffix,
|
|
381
391
|
ieee8021xAuth,
|
|
382
392
|
ieee8021xState,
|
|
383
|
-
carrierChanges
|
|
393
|
+
carrierChanges,
|
|
394
|
+
bridgeMembers
|
|
384
395
|
};
|
|
385
396
|
};
|
|
386
397
|
for (let i = 0; i < devices.length; i += SCAN_CONCURRENCY) {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NetworkRouteData } from '../common/types';
|
|
2
|
+
export declare const parseIpRoutes: (stdout: string, family: string) => NetworkRouteData[] | null;
|
|
3
|
+
export declare const parseProcRoutes: (lines: string[]) => NetworkRouteData[];
|
|
4
|
+
export declare const networkRoutes: () => Promise<NetworkRouteData[]>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.networkRoutes = exports.parseProcRoutes = exports.parseIpRoutes = void 0;
|
|
4
|
+
const common_1 = require("../common");
|
|
5
|
+
const exec_1 = require("../common/exec");
|
|
6
|
+
const files_1 = require("../common/files");
|
|
7
|
+
const EXEC_OPTS = { timeout: 5000, maxBuffer: 1024 * 1024 * 16 };
|
|
8
|
+
const toCidr = (dst, family) => {
|
|
9
|
+
if (!dst || dst === 'default') {
|
|
10
|
+
return family === 'IPv6' ? '::/0' : '0.0.0.0/0';
|
|
11
|
+
}
|
|
12
|
+
return dst.includes('/') ? dst : `${dst}/${family === 'IPv6' ? 128 : 32}`;
|
|
13
|
+
};
|
|
14
|
+
const parseIpRoutes = (stdout, family) => {
|
|
15
|
+
let routes = [];
|
|
16
|
+
try {
|
|
17
|
+
routes = JSON.parse(stdout);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
if (!Array.isArray(routes)) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const result = [];
|
|
26
|
+
for (const route of routes) {
|
|
27
|
+
const destination = toCidr(String(route?.dst || ''), family);
|
|
28
|
+
const metric = typeof route?.metric === 'number' ? route.metric : 0;
|
|
29
|
+
const hops = Array.isArray(route?.nexthops) && route.nexthops.length ? route.nexthops : [route];
|
|
30
|
+
for (const hop of hops) {
|
|
31
|
+
result.push({ destination, gateway: String(hop?.gateway || ''), iface: String(hop?.dev || ''), metric, family });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
exports.parseIpRoutes = parseIpRoutes;
|
|
37
|
+
const hexToIp = (hex) => (hex.match(/../g) || [])
|
|
38
|
+
.reverse()
|
|
39
|
+
.map((byte) => parseInt(byte, 16))
|
|
40
|
+
.join('.');
|
|
41
|
+
const parseProcRoutes = (lines) => lines
|
|
42
|
+
.slice(1)
|
|
43
|
+
.map((line) => line.trim().split(/\s+/))
|
|
44
|
+
.filter((parts) => parts.length >= 8 && (parseInt(parts[3] || '0', 16) & 1) === 1)
|
|
45
|
+
.map((parts) => {
|
|
46
|
+
const prefix = (parseInt(parts[7] || '0', 16) >>> 0).toString(2).replace(/0/g, '').length;
|
|
47
|
+
const gateway = hexToIp(parts[2] || '');
|
|
48
|
+
return {
|
|
49
|
+
destination: `${hexToIp(parts[1] || '')}/${prefix}`,
|
|
50
|
+
gateway: gateway === '0.0.0.0' ? '' : gateway,
|
|
51
|
+
iface: parts[0] || '',
|
|
52
|
+
metric: parseInt(parts[6] || '', 10) || 0,
|
|
53
|
+
family: 'IPv4'
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
exports.parseProcRoutes = parseProcRoutes;
|
|
57
|
+
const networkRoutes = async () => {
|
|
58
|
+
await (0, common_1.nextTick)();
|
|
59
|
+
try {
|
|
60
|
+
const [v4, v6] = await Promise.all([(0, exec_1.execFile)('ip', ['-j', 'route', 'show'], EXEC_OPTS), (0, exec_1.execFile)('ip', ['-j', '-6', 'route', 'show'], EXEC_OPTS).catch(() => ({ stdout: '[]' }))]);
|
|
61
|
+
const routes = (0, exports.parseIpRoutes)(v4.stdout.toString(), 'IPv4');
|
|
62
|
+
if (routes) {
|
|
63
|
+
return [...routes, ...((0, exports.parseIpRoutes)(v6.stdout.toString(), 'IPv6') || [])];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch { }
|
|
67
|
+
return (0, exports.parseProcRoutes)(await (0, files_1.readFileLines)('/proc/net/route'));
|
|
68
|
+
};
|
|
69
|
+
exports.networkRoutes = networkRoutes;
|