winload-rust-bin 0.1.9 → 0.1.11-beta.2

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.
Files changed (4) hide show
  1. package/bin.js +9 -3
  2. package/index.js +20 -10
  3. package/package.json +7 -7
  4. package/readme.md +19 -14
package/bin.js CHANGED
@@ -1,10 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /**
4
- * @vincentzyuapps/winload CLI entry point
4
+ * 📦 winload npm CLI entry point.
5
5
  *
6
- * 定位当前平台的预编译二进制并透传所有参数执行。
7
- * 用户通过 `npx @vincentzyuapps/winload` 或全局安装后直接 `winload` 即可运行。
6
+ * 🚀 This launcher is shared by the Rust binary npm distribution.
7
+ * 🧭 Users can install it in three ways:
8
+ * - npm install -g @vincentzyuapps/winload
9
+ * - npm install -g winload-rust-bin
10
+ * - npm install -g @vincentzyuapps/winload --registry https://npm.pkg.github.com
11
+ *
12
+ * 🔎 It resolves the current platform package and forwards all CLI arguments to
13
+ * the precompiled Rust binary.
8
14
  */
9
15
 
10
16
  "use strict";
package/index.js CHANGED
@@ -1,10 +1,17 @@
1
1
  /**
2
- * @vincentzyuapps/winload binary path resolver
2
+ * 📦 winload npm binary path resolver.
3
3
  *
4
- * npm 安装时会根据 optionalDependencies 中各平台包的 os/cpu 字段,
5
- * 仅下载与当前平台匹配的那一个。此模块负责定位该平台包中的二进制。
4
+ * 🧭 The npm release is available as:
5
+ * - @vincentzyuapps/winload on npm
6
+ * - winload-rust-bin on npm
7
+ * - @vincentzyuapps/winload on GitHub Packages
6
8
  *
7
- * 原理同 esbuild / @biomejs/biome / turbo 等项目。
9
+ * 🧩 optionalDependencies use each platform package's os/cpu fields, so npm only
10
+ * installs the package matching the current machine. This module locates that
11
+ * platform package and returns the bundled Rust binary path.
12
+ *
13
+ * 🛠 This follows the same packaging pattern used by projects such as esbuild,
14
+ * @biomejs/biome, and turbo.
8
15
  */
9
16
 
10
17
  "use strict";
@@ -12,9 +19,9 @@
12
19
  const path = require("path");
13
20
 
14
21
  /**
15
- * 平台映射表
22
+ * 🗺 Platform package mapping.
16
23
  * key: `${process.platform}-${process.arch}`
17
- * value: npm 平台包名
24
+ * value: npm platform package name
18
25
  */
19
26
  const PLATFORMS = {
20
27
  "win32-x64": "@vincentzyuapps/winload-win32-x64",
@@ -26,9 +33,9 @@ const PLATFORMS = {
26
33
  };
27
34
 
28
35
  /**
29
- * 获取当前平台对应的 winload 二进制绝对路径
30
- * @returns {string} 二进制路径
31
- * @throws {Error} 不支持的平台 / 平台包未安装
36
+ * 🔎 Resolve the absolute path to the winload binary for the current platform.
37
+ * @returns {string} Binary path
38
+ * @throws {Error} Unsupported platform or missing platform package
32
39
  */
33
40
  function getBinaryPath() {
34
41
  const key = `${process.platform}-${process.arch}`;
@@ -50,7 +57,10 @@ function getBinaryPath() {
50
57
  } catch {
51
58
  throw new Error(
52
59
  `winload: platform package "${pkg}" not found\n` +
53
- `Try reinstalling: npm install @vincentzyuapps/winload\n` +
60
+ `Try reinstalling one of:\n` +
61
+ ` npm install @vincentzyuapps/winload\n` +
62
+ ` npm install winload-rust-bin\n` +
63
+ ` npm install @vincentzyuapps/winload --registry https://npm.pkg.github.com\n` +
54
64
  `Or download manually: https://github.com/VincentZyuApps/winload/releases`
55
65
  );
56
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "winload-rust-bin",
3
- "version": "0.1.9",
3
+ "version": "0.1.11-beta.2",
4
4
  "description": "Network Load Monitor — nload-like TUI tool for Windows/Linux/macOS (prebuilt Rust binary)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -33,11 +33,11 @@
33
33
  "access": "public"
34
34
  },
35
35
  "optionalDependencies": {
36
- "@vincentzyuapps/winload-win32-x64": "0.1.9",
37
- "@vincentzyuapps/winload-win32-arm64": "0.1.9",
38
- "@vincentzyuapps/winload-linux-x64": "0.1.9",
39
- "@vincentzyuapps/winload-linux-arm64": "0.1.9",
40
- "@vincentzyuapps/winload-darwin-x64": "0.1.9",
41
- "@vincentzyuapps/winload-darwin-arm64": "0.1.9"
36
+ "@vincentzyuapps/winload-win32-x64": "0.1.11-beta.2",
37
+ "@vincentzyuapps/winload-win32-arm64": "0.1.11-beta.2",
38
+ "@vincentzyuapps/winload-linux-x64": "0.1.11-beta.2",
39
+ "@vincentzyuapps/winload-linux-arm64": "0.1.11-beta.2",
40
+ "@vincentzyuapps/winload-darwin-x64": "0.1.11-beta.2",
41
+ "@vincentzyuapps/winload-darwin-arm64": "0.1.11-beta.2"
42
42
  }
43
43
  }
package/readme.md CHANGED
@@ -60,7 +60,7 @@ https://github.com/rolandriegel/nload
60
60
  git clone https://github.com/VincentZyuApps/winload.git
61
61
  # or clone from Gitee (faster in China Mainland):
62
62
  # git clone https://gitee.com/vincent-zyu/winload.git
63
- cd winload/py
63
+ cd winload/python
64
64
  pip install -r requirements.txt
65
65
  python main.py
66
66
  ```
@@ -165,8 +165,10 @@ which winload
165
165
  ### macOS / Linux (Homebrew)
166
166
  > 📄 [Homebrew Formula (GitHub)](https://github.com/VincentZyuApps/homebrew-tap/blob/main/Formula/winload.rb)
167
167
  > 📄 [Homebrew Formula (Gitee)](https://gitee.com/vincent-zyu/homebrew-tap/blob/main/Formula/winload.rb)
168
+ > Recent Homebrew versions may require trusting third-party tap formulae before installation.
168
169
  ```bash
169
170
  brew tap vincentzyuapps/tap
171
+ brew trust vincentzyuapps/tap
170
172
  # or from Gitee (manual tap clone):
171
173
  # git clone https://gitee.com/vincent-zyu/homebrew-tap.git "$(brew --prefix)/Library/Taps/vincentzyuapps/homebrew-tap"
172
174
  brew update && brew install winload
@@ -202,12 +204,13 @@ which winload
202
204
  winload # Monitor all active network interfaces
203
205
  winload -t 200 # Set refresh interval to 200ms
204
206
  winload -d "Wi-Fi" # Start with a specific device
205
- winload --title # Show "winload <version>" as the header title
206
207
  winload --title "My Monitor" # Use a custom header title
207
- winload --title "" # Keep the default device header
208
208
  winload -e # Enable emoji decorations 🎉
209
+ winload --max-mode smart --max-half-life 10 # Smooth adaptive Y-axis (default)
210
+ winload --max-mode legacy # nload-style visible-history scaling
211
+ winload --max-mode fixed --max-y-value 10M # Fixed Y-axis max
209
212
  winload --npcap # Capture 127.0.0.1 loopback traffic (Windows, requires Npcap)
210
- winload --netlink # Manually enable RTNETLINK (Linux/Android Rust edition, off by default)
213
+ winload --netlink # Manually enable RTNETLINK (Linux/Android, off by default)
211
214
  ```
212
215
 
213
216
  ### Options
@@ -224,26 +227,27 @@ winload --netlink # Manually enable RTNETLINK (Linux/Android Rust edition, of
224
227
  | `-b`, `--bar-style <STYLE>` | Bar style: `fill`, `color`, or `plain` | `fill` |
225
228
  | `--in-color <HEX>` | Incoming graph color, hex RGB (e.g. `0x00d7ff`) | cyan |
226
229
  | `--out-color <HEX>` | Outgoing graph color, hex RGB (e.g. `0xffaf00`) | gold |
227
- | `-m`, `--max <VALUE>` | Fixed Y-axis max (e.g. `10M`, `1G`, `500K`) *conflicts with `--smart-max`* | auto |
228
- | `--smart-max [SECS]` | Smart adaptive Y-axis: auto-decays after traffic spikes (default half-life: 10s) — *conflicts with `--max`* | off |
230
+ | `--max-mode <MODE>` | Y-axis scaling mode: `smart`, `legacy`, or `fixed` | `smart` |
231
+ | `--max-half-life <SECS>` | Half-life for smart Y-axis decay | `10` |
232
+ | `--max-y-value <VALUE>` | Fixed Y-axis max for `--max-mode fixed` (e.g. `10M`, `1G`, `500K`) | — |
229
233
  | `-n`, `--no-graph` | Hide graph, show stats only | off |
230
234
  | `--hide-separator` | Hide the separator line (row of equals signs) | off |
231
235
  | `--no-color` | Disable all TUI colors (monochrome mode) | off |
232
236
  | `--npcap` | **[Windows Rust Only]** Capture loopback traffic via Npcap (recommended) | off |
233
- | `--netlink` | **[Linux/Android Rust Only]** Use RTNETLINK instead of sysinfo (for Termux proot distro or restricted environments) | off |
237
+ | `--netlink` | **[Linux/Android Only]** Use RTNETLINK instead of the default backend (for Termux proot distro or restricted environments) | off |
234
238
  | `--debug-info` | Print network interface debug info and exit | — |
235
239
  | `-h`, `--help` | Print help (`--help --emoji` for emoji version!) | — |
236
240
  | `-V`, `--version` | Print version | — |
237
241
 
238
- > **Y-axis scaling modes** — there are three mutually exclusive scenarios:
242
+ > **Y-axis scaling modes**
239
243
  >
240
244
  > | Mode | Flag | Behavior |
241
245
  > |------|------|----------|
242
- > | **Fixed max** | `--max <VALUE>` | Y-axis is locked to the specified value (e.g. `10M`, `1G`). |
243
- > | **Smart max** | `--smart-max [SECS]` | Y-axis adapts automatically: jumps up on traffic spikes, then smoothly decays back down (exponential decay, default half-life 10 s). |
244
- > | **History peak** | *(neither flag)* | Y-axis follows the historical maximum of each metric — the default behavior. |
246
+ > | **smart** | `--max-mode smart --max-half-life 10` | Default. Jumps up on traffic spikes, then smoothly decays back down. |
247
+ > | **legacy** | `--max-mode legacy` | nload-style scaling based on the visible graph history peak. |
248
+ > | **fixed** | `--max-mode fixed --max-y-value 10M` | Locks the Y-axis to the specified value. |
245
249
  >
246
- > ⚠️ `--max` and `--smart-max` **conflict with each other** you can only use one at a time.
250
+ > `--max-y-value` is only valid with `--max-mode fixed`; `--max-half-life` is only valid with `--max-mode smart`.
247
251
 
248
252
  ### Keyboard Shortcuts
249
253
 
@@ -273,13 +277,13 @@ This requires [Npcap](https://npcap.com/#download) installed with "Support loopb
273
277
 
274
278
  On Linux and macOS, loopback traffic works out of the box — no extra flags needed.
275
279
 
276
- On **Linux/Android**, if `/proc/net/dev` is not accessible (e.g. inside a Termux proot distro or other restricted environments), the Rust edition can use `--netlink` to collect network stats via RTNETLINK directly:
280
+ On **Linux/Android**, if `/proc/net/dev` is not accessible (e.g. inside a Termux proot distro or other restricted environments), use `--netlink` to collect network stats via RTNETLINK directly:
277
281
 
278
282
  ```bash
279
283
  winload --netlink
280
284
  ```
281
285
 
282
- > Note: `--netlink` is an **opt-in backend**, similar to `--npcap`; it is never enabled unless you pass the flag. Normal Linux/Android runs still use sysinfo by default. This flag is **Linux/Android Rust edition only**; the Python edition does not support `--netlink` and continues to use psutil. macOS does not support netlink.
286
+ > Note: `--netlink` is an **opt-in backend**, similar to `--npcap`; it is never enabled unless you pass the flag. Normal Linux/Android runs still use the default backend (Rust: sysinfo, Python: psutil). The Python edition uses `pyroute2` for RTNETLINK on Linux/Android. macOS does not support netlink.
283
287
  >
284
288
  > 📖 For a deep dive into Linux/Android network statistics collection, see [docs/linux_android_netlink.md](docs/linux_android_netlink.md)
285
289
 
@@ -306,6 +310,7 @@ winload --netlink
306
310
  |:---|:---|:---|
307
311
  | [![Python](https://img.shields.io/badge/Python-3.13.11-3776AB?style=flat-square&logo=python&logoColor=white)](https://python.org/) | 3.13.11 | Programming language |
308
312
  | [![psutil](https://img.shields.io/badge/psutil-≥7.0-FFD43B?style=flat-square&logo=python&logoColor=white)](https://github.com/giampaolo/psutil) | ≥7.0 | Process and system utilities |
313
+ | [![pyroute2](https://img.shields.io/badge/pyroute2-≥0.9.6-FFD43B?style=flat-square&logo=python&logoColor=white)](https://github.com/svinota/pyroute2) | ≥0.9.6 | RTNETLINK backend on Linux/Android |
309
314
  | [![windows-curses](https://img.shields.io/badge/windows--curses-≥2.0-FFD43B?style=flat-square&logo=python&logoColor=white)](https://github.com/zhirui2020/windows-curses) | ≥2.0 | Windows curses support |
310
315
 
311
316
  ### Rust Edition