No description
  • Rust 75%
  • Python 25%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
adminroot 6219f4c9f2
All checks were successful
Release / release (push) Successful in 36s
Release v0.1.3: anchor traffic view at the top left
2026-09-29 17:04:53 +00:00
.cargo Add traffic CLI and Forgejo binary release workflow 2026-09-28 18:51:49 +00:00
.forgejo/workflows Install jq in the Forgejo runner before publishing 2026-09-28 19:02:46 +00:00
.github/workflows Add traffic CLI and Forgejo binary release workflow 2026-09-28 18:51:49 +00:00
scripts Release v0.1.3: anchor traffic view at the top left 2026-09-29 17:04:53 +00:00
src Release v0.1.3: anchor traffic view at the top left 2026-09-29 17:04:53 +00:00
.gitignore Add traffic CLI and Forgejo binary release workflow 2026-09-28 18:51:49 +00:00
Cargo.lock Release v0.1.3: anchor traffic view at the top left 2026-09-29 17:04:53 +00:00
Cargo.toml Release v0.1.3: anchor traffic view at the top left 2026-09-29 17:04:53 +00:00
README.md Release v0.1.3: anchor traffic view at the top left 2026-09-29 17:04:53 +00:00

traffic

轻量的 Linux 网速工具,一个文件即可运行,支持 amd64 和 arm64。

╭─ traffic ──────────────╮
│     DL          UP     │
│  2.45MB/s   128.30KB/s │
│  12.34GB      5.67GB   │
╰────────────────────────╯

左边下载,右边上传;上面是实时速度,下面是累计流量。自动选择主网卡,从终端左上角显示,每秒清屏刷新。按 q 或 Ctrl+C 退出,回到原来的终端画面。

累计流量来自系统,没开程序也会累计,重启或重建网卡后可能归零。单位按 1000 进位。

使用

从发布页下载对应架构的文件,重命名为 traffic。更新时替换这个文件即可。

chmod +x traffic
./traffic                     # 启动,按 q 退出
./traffic --list              # 查看网卡
./traffic -i eth0             # 指定网卡
./traffic -n 0.5 --bits       # 每半秒刷新,速度用 bit/s
./traffic --plain -c 5        # 输出 5 次,不进入全屏
./traffic --json -c 5         # 输出 5 次 JSON,方便脚本读取
./traffic --help              # 查看全部参数

构建与发布

需要 Linux 和 Rust 1.85+:

cargo build --release
./target/release/traffic

发布前更新 Cargo.toml、Cargo.lock 的版本并提交,再推送标签:

git tag v0.1.3
git push --atomic origin main v0.1.3

Forgejo Actions 会自动发布 traffic-linux-amd64 和 traffic-linux-arm64,下载后即可运行。