winload-rust-bin 0.1.7-beta.4
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 +166 -0
- package/bin.js +28 -0
- package/index.js +59 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# Winload <img src="https://github.com/user-attachments/assets/62fec846-0442-47f6-bbba-78acdc8803ef" height="32px">
|
|
4
|
+
|
|
5
|
+
> A lightweight, real-time CLI tool for monitoring network bandwidth and traffic, inspired by Linux's nload.
|
|
6
|
+
|
|
7
|
+
> **[📖 English](readme.md)**
|
|
8
|
+
> **[📖 简体中文(大陆)](readme.zh-cn.md)**
|
|
9
|
+
> **[📖 繁體中文(台灣)](readme.zh-tw.md)**
|
|
10
|
+
> **[📖 日本語](readme.jp.md)**
|
|
11
|
+
> **[📖 한국어](readme.ko.md)**
|
|
12
|
+
|
|
13
|
+
[](https://github.com/VincentZyuApps/winload)
|
|
14
|
+
[](https://gitee.com/vincent-zyu/winload)
|
|
15
|
+
|
|
16
|
+
[](https://github.com/VincentZyuApps/winload/releases)
|
|
17
|
+
[](https://github.com/VincentZyuApps/winload/releases)
|
|
18
|
+
[](https://github.com/VincentZyuApps/winload/releases)
|
|
19
|
+
[](https://github.com/VincentZyuApps/winload/releases)
|
|
20
|
+
|
|
21
|
+
[](https://pypi.org/project/winload/)
|
|
22
|
+
[](https://www.npmjs.com/package/winload-rust-bin)
|
|
23
|
+
|
|
24
|
+
[](https://scoop.sh/#/apps?q=%22https%3A%2F%2Fgithub.com%2FVincentZyuApps%2Fscoop-bucket%22&o=false)
|
|
25
|
+
[](https://aur.archlinux.org/packages/winload-rust-bin)
|
|
26
|
+
[](https://github.com/VincentZyuApps/winload/releases)
|
|
27
|
+
[](https://github.com/VincentZyuApps/winload/releases)
|
|
28
|
+
|
|
29
|
+
> **[📖 Build Docs](.github/workflows/build.md)**
|
|
30
|
+
|
|
31
|
+
## 🚀 Introduction
|
|
32
|
+
Winload brings an intuitive, visual network monitor to the modern terminal. It started as a Windows-focused tool to fill the nload gap, and now targets Linux and macOS as well.
|
|
33
|
+
|
|
34
|
+
## 🙏 Acknowledgements
|
|
35
|
+
Winload is inspired by the classic nload project by Roland Riegel. Many thanks for the original idea and experience.
|
|
36
|
+
https://github.com/rolandriegel/nload
|
|
37
|
+
|
|
38
|
+
## ✨ Key Features
|
|
39
|
+
- **Dual implementations**
|
|
40
|
+
- **Rust edition**: fast, memory-safe, single static binary—great for everyday monitoring.
|
|
41
|
+
- **Python edition**: easy to hack and extend for prototyping or integrations.
|
|
42
|
+
- **Cross-platform**: Windows, Linux, and macOS (x64 & ARM64).
|
|
43
|
+
- **Real-time visualization**: live incoming/outgoing graphs and throughput stats.
|
|
44
|
+
- **Minimal UI**: clean TUI that mirrors nload's ergonomics.
|
|
45
|
+
|
|
46
|
+
## 📥 Python Edition Installation
|
|
47
|
+
> 💡 **Implementation Note**: Only PyPI and source code from GitHub/Gitee provide Python edition.
|
|
48
|
+
> All package managers (Scoop, AUR, npm, APT, RPM) distribute **Rust binaries only**.
|
|
49
|
+
### Python (pip)
|
|
50
|
+
```bash
|
|
51
|
+
pip install winload
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 📥 Rust Edition Installation (recommended)
|
|
55
|
+
### npm (cross-platform)
|
|
56
|
+
```bash
|
|
57
|
+
npm install -g winload-rust-bin
|
|
58
|
+
# or use npx directly
|
|
59
|
+
npx winload-rust-bin
|
|
60
|
+
```
|
|
61
|
+
> Includes 6 precompiled binaries for x86_64 & ARM64 across Windows, Linux, and macOS.
|
|
62
|
+
### Windows (Scoop)
|
|
63
|
+
```powershell
|
|
64
|
+
scoop bucket add vincentzyu https://github.com/VincentZyuApps/scoop-bucket
|
|
65
|
+
scoop install winload
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Arch Linux (AUR):
|
|
69
|
+
```bash
|
|
70
|
+
paru -S winload-rust-bin
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Linux (one-liner)
|
|
74
|
+
> Supports Debian/Ubuntu and derivatives — Linux Mint, Pop!_OS, Deepin, UOS, etc. (apt)
|
|
75
|
+
|
|
76
|
+
> Supports Fedora/RHEL and derivatives — Rocky Linux, AlmaLinux, CentOS Stream, etc. (dnf)
|
|
77
|
+
```bash
|
|
78
|
+
curl -fsSL https://raw.githubusercontent.com/VincentZyuApps/winload/main/docs/install_scripts/install.sh | bash
|
|
79
|
+
```
|
|
80
|
+
> 📄 [View install script source](https://github.com/VincentZyuApps/winload/blob/main/docs/install_scripts/install.sh)
|
|
81
|
+
|
|
82
|
+
<details>
|
|
83
|
+
<summary>Manual install</summary>
|
|
84
|
+
|
|
85
|
+
**DEB (Debian/Ubuntu):**
|
|
86
|
+
```bash
|
|
87
|
+
# Download the latest .deb from GitHub Releases
|
|
88
|
+
sudo dpkg -i ./winload_*_amd64.deb
|
|
89
|
+
# or use apt (auto-resolves dependencies)
|
|
90
|
+
sudo apt install ./winload_*_amd64.deb
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**RPM (Fedora/RHEL):**
|
|
94
|
+
```bash
|
|
95
|
+
sudo dnf install ./winload-*-1.x86_64.rpm
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Or download binaries directly from [GitHub Releases](https://github.com/VincentZyuApps/winload/releases).**
|
|
99
|
+
|
|
100
|
+
</details>
|
|
101
|
+
|
|
102
|
+
## ⌨️ Usage
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
winload # Monitor all active network interfaces
|
|
106
|
+
winload -t 200 # Set refresh interval to 200ms
|
|
107
|
+
winload -d "Wi-Fi" # Start with a specific device
|
|
108
|
+
winload -e # Enable emoji decorations 🎉
|
|
109
|
+
winload --npcap # Capture 127.0.0.1 loopback traffic (Windows, requires Npcap)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Options
|
|
113
|
+
|
|
114
|
+
| Flag | Description | Default |
|
|
115
|
+
|------|-------------|---------|
|
|
116
|
+
| `-t`, `--interval <MS>` | Refresh interval in milliseconds | `500` |
|
|
117
|
+
| `-a`, `--average <SEC>` | Average calculation window in seconds | `300` |
|
|
118
|
+
| `-d`, `--device <NAME>` | Default device name (partial match) | — |
|
|
119
|
+
| `-e`, `--emoji` | Enable emoji decorations in TUI 🎉 | off |
|
|
120
|
+
| `-U`, `--unicode` | Use Unicode block characters for graph (█▓░·) | off |
|
|
121
|
+
| `-u`, `--unit <UNIT>` | Display unit: `bit` or `byte` | `bit` |
|
|
122
|
+
| `-b`, `--bar-style <STYLE>` | Bar style: `fill`, `color`, or `plain` | `fill` |
|
|
123
|
+
| `--in-color <HEX>` | Incoming graph color, hex RGB (e.g. `0x00d7ff`) | cyan |
|
|
124
|
+
| `--out-color <HEX>` | Outgoing graph color, hex RGB (e.g. `0xffaf00`) | gold |
|
|
125
|
+
| `-m`, `--max <VALUE>` | Fixed Y-axis max (e.g. `10M`, `1G`, `500K`) | auto |
|
|
126
|
+
| `-n`, `--no-graph` | Hide graph, show stats only | off |
|
|
127
|
+
| `--hide-separator` | Hide the separator line (row of equals signs) | off |
|
|
128
|
+
| `--no-color` | Disable all TUI colors (monochrome mode) | off |
|
|
129
|
+
| `--npcap` | **[Windows Rust Only]** Capture loopback traffic via Npcap (recommended) | off |
|
|
130
|
+
| `--debug-info` | **[Rust Only]** Print network interface debug info and exit | — |
|
|
131
|
+
| `-h`, `--help` | Print help (`--help --emoji` for emoji version!) | — |
|
|
132
|
+
| `-V`, `--version` | **[Rust Only]** Print version | — |
|
|
133
|
+
|
|
134
|
+
### Keyboard Shortcuts
|
|
135
|
+
|
|
136
|
+
| Key | Action |
|
|
137
|
+
|-----|--------|
|
|
138
|
+
| `←` / `→` or `↑` / `↓` | Switch network device |
|
|
139
|
+
| `=` | Toggle separator line visibility |
|
|
140
|
+
| `c` | Toggle color on/off |
|
|
141
|
+
| `q` / `Esc` | Quit |
|
|
142
|
+
|
|
143
|
+
## 🪟 Windows Loopback (127.0.0.1)
|
|
144
|
+
|
|
145
|
+
Windows cannot report loopback traffic through standard APIs — this is a [functional deficiency in Windows' network stack](docs/win_loopback.md).
|
|
146
|
+
|
|
147
|
+
**To capture loopback traffic on Windows**, use the `--npcap` flag:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
winload --npcap
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
This requires [Npcap](https://npcap.com/#download) installed with "Support loopback traffic capture" enabled during setup.
|
|
154
|
+
|
|
155
|
+
> I previously tried polling Windows' own `GetIfEntry` API directly, but the counters are always 0 for loopback — there is simply no NDIS driver behind the loopback pseudo-interface to count anything. That code path has been removed.
|
|
156
|
+
|
|
157
|
+
> 📖 For a deep dive into why Windows loopback is broken, see [docs/win_loopback.md](docs/win_loopback.md)
|
|
158
|
+
|
|
159
|
+
On Linux and macOS, loopback traffic works out of the box — no extra flags needed.
|
|
160
|
+
|
|
161
|
+
## 🖼️ Previews
|
|
162
|
+
#### Python Edition Preview
|
|
163
|
+

|
|
164
|
+
|
|
165
|
+
#### Rust Edition Preview
|
|
166
|
+

|
package/bin.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* winload-rust-bin — CLI entry point
|
|
5
|
+
*
|
|
6
|
+
* 定位当前平台的预编译二进制并透传所有参数执行。
|
|
7
|
+
* 用户通过 `npx winload-rust-bin` 或全局安装后直接 `winload` 即可运行。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";
|
|
11
|
+
|
|
12
|
+
const { spawnSync } = require("child_process");
|
|
13
|
+
const { getBinaryPath } = require("./index.js");
|
|
14
|
+
|
|
15
|
+
const bin = getBinaryPath();
|
|
16
|
+
|
|
17
|
+
// Show implementation info for help & version flags
|
|
18
|
+
const args = process.argv.slice(2);
|
|
19
|
+
if (args.includes("--help") || args.includes("-h") || args.includes("--version") || args.includes("-V")) {
|
|
20
|
+
console.error("ℹ️ This is the Rust binary edition (installed from npm)\n");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const result = spawnSync(bin, args, {
|
|
24
|
+
stdio: "inherit",
|
|
25
|
+
windowsHide: false,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
process.exit(result.status ?? 1);
|
package/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* winload-rust-bin — binary path resolver
|
|
3
|
+
*
|
|
4
|
+
* npm 安装时会根据 optionalDependencies 中各平台包的 os/cpu 字段,
|
|
5
|
+
* 仅下载与当前平台匹配的那一个。此模块负责定位该平台包中的二进制。
|
|
6
|
+
*
|
|
7
|
+
* 原理同 esbuild / @biomejs/biome / turbo 等项目。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
"use strict";
|
|
11
|
+
|
|
12
|
+
const path = require("path");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 平台映射表
|
|
16
|
+
* key: `${process.platform}-${process.arch}`
|
|
17
|
+
* value: npm 平台包名
|
|
18
|
+
*/
|
|
19
|
+
const PLATFORMS = {
|
|
20
|
+
"win32-x64": "winload-rust-bin-win32-x64",
|
|
21
|
+
"win32-arm64": "winload-rust-bin-win32-arm64",
|
|
22
|
+
"linux-x64": "winload-rust-bin-linux-x64",
|
|
23
|
+
"linux-arm64": "winload-rust-bin-linux-arm64",
|
|
24
|
+
"darwin-x64": "winload-rust-bin-darwin-x64",
|
|
25
|
+
"darwin-arm64": "winload-rust-bin-darwin-arm64",
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 获取当前平台对应的 winload 二进制绝对路径
|
|
30
|
+
* @returns {string} 二进制路径
|
|
31
|
+
* @throws {Error} 不支持的平台 / 平台包未安装
|
|
32
|
+
*/
|
|
33
|
+
function getBinaryPath() {
|
|
34
|
+
const key = `${process.platform}-${process.arch}`;
|
|
35
|
+
const pkg = PLATFORMS[key];
|
|
36
|
+
|
|
37
|
+
if (!pkg) {
|
|
38
|
+
const supported = Object.keys(PLATFORMS).join(", ");
|
|
39
|
+
throw new Error(
|
|
40
|
+
`winload: unsupported platform "${key}"\n` +
|
|
41
|
+
`Supported: ${supported}\n` +
|
|
42
|
+
`Download manually: https://github.com/VincentZyuApps/winload/releases`
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
const pkgDir = path.dirname(require.resolve(`${pkg}/package.json`));
|
|
48
|
+
const ext = process.platform === "win32" ? ".exe" : "";
|
|
49
|
+
return path.join(pkgDir, "bin", `winload${ext}`);
|
|
50
|
+
} catch {
|
|
51
|
+
throw new Error(
|
|
52
|
+
`winload: platform package "${pkg}" not found\n` +
|
|
53
|
+
`Try reinstalling: npm install winload-rust-bin\n` +
|
|
54
|
+
`Or download manually: https://github.com/VincentZyuApps/winload/releases`
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
module.exports = { getBinaryPath, PLATFORMS };
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "winload-rust-bin",
|
|
3
|
+
"version": "0.1.7-beta.4",
|
|
4
|
+
"description": "Network Load Monitor — nload-like TUI tool for Windows/Linux/macOS (prebuilt Rust binary)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://gitee.com/vincent-zyu/winload"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/VincentZyuApps/winload",
|
|
11
|
+
"author": "VincentZyu <1830540513zyu@gmail.com>",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"network",
|
|
14
|
+
"monitor",
|
|
15
|
+
"nload",
|
|
16
|
+
"tui",
|
|
17
|
+
"bandwidth",
|
|
18
|
+
"traffic",
|
|
19
|
+
"cli",
|
|
20
|
+
"rust"
|
|
21
|
+
],
|
|
22
|
+
"bin": {
|
|
23
|
+
"winload": "bin.js"
|
|
24
|
+
},
|
|
25
|
+
"main": "index.js",
|
|
26
|
+
"files": [
|
|
27
|
+
"bin.js",
|
|
28
|
+
"index.js",
|
|
29
|
+
"README.md"
|
|
30
|
+
],
|
|
31
|
+
"optionalDependencies": {
|
|
32
|
+
"winload-rust-bin-win32-x64": "0.1.7-beta.4",
|
|
33
|
+
"winload-rust-bin-win32-arm64": "0.1.7-beta.4",
|
|
34
|
+
"winload-rust-bin-linux-x64": "0.1.7-beta.4",
|
|
35
|
+
"winload-rust-bin-linux-arm64": "0.1.7-beta.4",
|
|
36
|
+
"winload-rust-bin-darwin-x64": "0.1.7-beta.4",
|
|
37
|
+
"winload-rust-bin-darwin-arm64": "0.1.7-beta.4"
|
|
38
|
+
}
|
|
39
|
+
}
|