Skip to content

Commit a486409

Browse files
committed
feat: add lightweight LAN and network services
1 parent cd215fd commit a486409

21 files changed

Lines changed: 2868 additions & 19 deletions

CHANGELOG.en.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
All notable changes to `ii` are documented here. The default Chinese version is [CHANGELOG.md](CHANGELOG.md).
44

5-
## Unreleased
5+
## 0.3.7 - 2026-08-07
66

77
### Added
88

@@ -15,6 +15,8 @@ All notable changes to `ii` are documented here. The default Chinese version is
1515
- `ii send`, `ii watch`, and `ii queue` accept repeated `--relay`; multiple explicit relays are probed for reachability and latency, while default n0 relay behavior is unchanged.
1616
- `ii send --web` and `ii web --upload` support resumable browser uploads; reselecting the same file after a disconnect or refresh continues it.
1717
- Added `ii socks5`, an ordinary SOCKS5 proxy with `CONNECT`, `UDP ASSOCIATE`, `BIND`, IPv4, IPv6, domain targets, and optional username/password authentication.
18+
- Added the `ii http` read-only directory site, `ii paste` text sharing, `ii drop` resumable upload drop box, `ii pac` PAC hosting, and `ii speed` bidirectional HTTP chunked throughput tests. They reuse LAN URLs, QR codes, tokens, and discovery.
19+
- Added the `ii proxy` HTTP forward proxy, `ii tcp`/`ii udp` fixed-target forwarders, `ii ping` TCP connect latency probe, `ii port` concurrent port checker, `ii health` HTTP(S)/TCP health check, and `ii wake` Wake-on-LAN sender.
1820

1921
## 0.3.4 - 2026-08-06
2022

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
本文件记录 `ii` 的重要变更。默认中文版本在这里,英文版本见 [CHANGELOG.en.md](CHANGELOG.en.md)
44

5-
## Unreleased
5+
## 0.3.7 - 2026-08-07
66

77
### 新增
88

@@ -15,6 +15,8 @@
1515
- `ii send``ii watch``ii queue``--relay` 可重复指定;多个显式 relay 会按探测到的可达性和延迟择优,默认 n0 relay 行为不变。
1616
- `ii send --web``ii web --upload` 支持浏览器分块上传续传,断网或刷新后重新选择同一文件即可继续。
1717
- 新增 `ii socks5` 普通 SOCKS5 代理,支持 `CONNECT``UDP ASSOCIATE``BIND`、IPv4、IPv6、域名目标和可选用户名密码认证。
18+
- 新增 `ii http` 只读目录站、`ii paste` 文本分享、`ii drop` 续传上传收集箱、`ii pac` PAC 托管与 `ii speed` 双向 HTTP chunked 测速;它们复用 LAN URL、二维码、token 和发现服务。
19+
- 新增 `ii proxy` HTTP 正向代理、`ii tcp`/`ii udp` 固定目标转发、`ii ping` TCP connect 延迟探测、`ii port` 并发端口检查、`ii health` HTTP(S)/TCP 健康检查和 `ii wake` Wake-on-LAN。
1820

1921
## 0.3.4 - 2026-08-06
2022

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ unused-async = "warn"
1818

1919
[package]
2020
name = "ii"
21-
version = "0.3.6"
21+
version = "0.3.7"
2222
edition.workspace = true
2323
rust-version.workspace = true
2424
license.workspace = true

README.en.md

Lines changed: 100 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,19 @@
3030

3131
### `ii web`
3232

33-
- Run a temporary LAN file site from the current directory for browsing, downloads, and uploads.
34-
- Import a phone photo library by starting `ii web` on a computer and uploading photos or videos after scanning its QR code.
33+
- Run a temporary LAN file site from the current directory for browsing and downloads; add `--upload` to accept uploads.
34+
- Import a phone photo library by starting `ii web --upload` on a computer and uploading photos or videos after scanning its QR code.
3535
- Distribute meeting materials through a QR code for direct download.
3636
- Serve local static assets such as installers, videos, or web files to TVs, tablets, and development devices.
37-
- Collect files from several people into a chosen directory.
37+
- Use `ii drop` as the upload-only, no-browsing, no-download subset of `ii web` to collect files from several people.
38+
- Use `ii http` as the read-only subset entry point for default `ii web`; it adds no transfer capability.
3839
- Provide a file portal on an offline LAN without cloud storage, accounts, or Internet access.
3940

41+
### `ii paste`
42+
43+
- Share Wi-Fi passwords, meeting codes, log excerpts, configuration, or short commands on the LAN; phones can scan and copy them.
44+
- Let scripts read temporary text through the `raw` URL without running another text service.
45+
4046
### `ii dav`
4147

4248
- Mount any directory as a network drive in Windows Explorer, macOS Finder, or a Linux file manager.
@@ -55,6 +61,16 @@
5561
- Provide a configurable proxy address to games, media players, or IoT devices that support one.
5662
- Compare DNS and connection paths across enterprise, VPN, and home networks.
5763

64+
### `ii proxy`
65+
66+
- Provide an ordinary HTTP forward proxy for browsers, downloaders, and other tools that support HTTP proxies.
67+
- Let LAN devices use a computer with a VPN, special routes, or access to the target network as their proxy exit.
68+
69+
### `ii pac`
70+
71+
- Host a PAC URL so browsers connect directly to LAN addresses and use a chosen HTTP or SOCKS5 proxy for other destinations.
72+
- Distribute proxy rules across a temporary office network, VPN, or test network without configuring each machine manually.
73+
5874
### `ii relay`
5975

6076
- Self-host an Iroh relay as the explicit cross-network forwarding path for `ii send --relay`.
@@ -67,12 +83,47 @@
6783
- Make a machine without a public IP reachable remotely.
6884
- Provide temporary remote assistance without configuring router port forwarding.
6985

86+
### `ii tcp`
87+
88+
- Forward a local listening port to a fixed TCP target such as SSH, a database, a development site, or an internal service.
89+
- Forward a known TCP service for tests, short integration work, or temporary port mapping.
90+
91+
### `ii udp`
92+
93+
- Forward UDP traffic to a fixed target for games, device discovery, or custom UDP protocol debugging.
94+
- Let LAN devices reach a UDP service through the current machine when they cannot reach it directly.
95+
7096
### `ii discover`
7197

7298
- Scan for running `ii` services on the LAN.
7399
- Find same-subnet send jobs, directory sites, and WebDAV services without typing IP addresses.
74100
- Discover shared endpoints quickly in meeting rooms, labs, and server rooms.
75101

102+
### `ii ping`
103+
104+
- Measure TCP connection latency to quickly determine whether a service is reachable or the network is unstable.
105+
- Compare connection quality across enterprise, VPN, home, or different egress networks.
106+
107+
### `ii speed`
108+
109+
- Run `ii speed serve` on one device and `ii speed` on another to measure actual LAN download and upload throughput.
110+
- Diagnose links whose advertised Wi-Fi bandwidth is high but whose file transfer speed is poor, without an Internet speed test.
111+
112+
### `ii wake`
113+
114+
- Send a Wake-on-LAN magic packet to a sleeping computer or NAS on the same subnet.
115+
- Wake a target device before remote file transfer, backup, or access.
116+
117+
### `ii port`
118+
119+
- Check whether multiple TCP ports on one host are open, refused, or timed out in one command.
120+
- Diagnose firewalls, service listeners, port mappings, and network policy issues.
121+
122+
### `ii health`
123+
124+
- Check an HTTP(S) health endpoint or a bare TCP service.
125+
- Monitor a service continuously and print only state changes for lightweight supervision or scripts.
126+
76127
## Install
77128

78129
Linux x86_64 and Apple Silicon macOS:
@@ -238,10 +289,33 @@ ii dav .\shared --port 8443 --username alice --password secret --tls --domain da
238289

239290
`ii web --once` exits only after the first complete ordinary-file `GET 200`. HEAD, Range, directory pages, 404 responses, and uploads do not consume the one-shot lifetime, and `--once` conflicts with `--upload`.
240291

292+
### Lightweight LAN Services
293+
294+
```powershell
295+
# Read-only directory site with browsing, Range, media playback, and downloads
296+
ii http .\public
297+
298+
# Text clipboard; without text, reads stdin; raw returns plain text
299+
ii paste "meeting code: 123456" --ttl 30m
300+
Get-Content .\note.txt -Raw | ii paste --token
301+
302+
# Upload-only drop box; defaults to .\ii\ under the startup directory
303+
ii drop .\incoming
304+
305+
# Host a PAC file for an existing HTTP or SOCKS5 proxy
306+
ii pac --proxy socks5://192.168.1.10:1080
307+
308+
# LAN throughput server and client
309+
ii speed serve --port 9000
310+
ii speed http://192.168.1.10:9000/ --duration 15s
311+
```
312+
313+
`ii http` has no upload or write endpoint. `ii drop` provides resumable multi-file uploads only: it does not list or download files, and an explicit directory is the upload destination. `ii paste` provides a copyable root page and a `text/plain` `raw` endpoint; `--ttl` stops it at expiry. `ii pac` returns a PAC file at its root URL: private, loopback, `.local`, and plain host names use `DIRECT`; other destinations use the selected proxy. All five commands accept `--port`, `--bind`, and `--token [value]`, print a QR code, LAN URL, and `other:`, and advertise through `ii discover`.
314+
241315
### LAN Discovery
242316

243317
```powershell
244-
# List ii send -t, ii web, and ii dav services on the same LAN
318+
# List ii send -t, web/dav, and lightweight HTTP services on the same LAN
245319
ii discover
246320
247321
# JSON Lines output
@@ -317,6 +391,28 @@ ii version
317391

318392
`ii doctor --nat` runs a short-lived UDP/NAT/relay probe and reports bound UDP sockets, IPv4/IPv6, NAT mapping behavior, the preferred relay, and relay reachability. Hairpin is explicitly unavailable because Iroh does not expose that probe.
319393

394+
## Proxy, Forwarding, and Network Tools
395+
396+
```powershell
397+
# HTTP forward proxy, with optional Basic authentication
398+
ii proxy --port 8080
399+
ii proxy --username alice --password secret
400+
401+
# Forward a local TCP or UDP port to one fixed target
402+
ii tcp db.internal:5432 --port 15432
403+
ii udp game.internal:27015 --port 27015
404+
405+
# TCP connect latency, port checks, and a continuous health check
406+
ii ping api.example.com:443 --count 4
407+
ii port api.example.com 80 443 8443
408+
ii health https://api.example.com/health --interval 10s
409+
410+
# Send a Wake-on-LAN magic packet
411+
ii wake aa:bb:cc:dd:ee:ff --broadcast 192.168.1.255
412+
```
413+
414+
`ii proxy` supports HTTP/1.0 and HTTP/1.1 absolute-form requests plus `CONNECT`. Ordinary HTTP requests use one connection per request; it does not decrypt TLS, cache, or proxy WebSockets. `ii tcp` and `ii udp` forward to one fixed target; UDP keeps one upstream session per client address and removes idle sessions after five minutes. `ii ping` measures TCP connect latency rather than sending ICMP. `ii port` checks TCP ports concurrently. `ii health` considers only HTTP(S) `2xx/3xx` healthy, or checks TCP connectivity for a bare `host:port`.
415+
320416
## Full Manual
321417

322418
Full command, configuration, and troubleshooting reference: [ii.md](ii.md).

README.md

Lines changed: 100 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,19 @@
3030

3131
### `ii web`
3232

33-
- 临时局域网文件站:当前目录一键公开浏览、下载和上传
34-
- 手机相册导入:电脑开 `ii web`,手机扫码上传照片或视频。
33+
- 临时局域网文件站:当前目录一键公开浏览和下载;加 `--upload` 后也可上传
34+
- 手机相册导入:电脑开 `ii web --upload`,手机扫码上传照片或视频。
3535
- 会议资料分发:用二维码让参会者直接下载。
3636
- 本地静态资源站:给电视、平板和开发设备访问安装包、视频或网页文件。
37-
- 临时文件收集箱:多人向指定目录上传材料。
37+
- 临时文件收集箱:用 `ii drop` 建立只上传、不浏览、不下载的 `ii web` 子集服务,集中收集材料。
38+
- 只读目录快捷入口:`ii http` 是默认只读 `ii web` 的子集入口,不增加任何传输能力。
3839
- 离线局域网环境的文件门户:不依赖云盘、账号或外网。
3940

41+
### `ii paste`
42+
43+
- 在局域网分享 Wi-Fi 密码、会议码、日志片段、配置或短命令;手机扫码即可复制。
44+
-`raw` 地址让脚本读取临时文本,不必额外搭建文本服务。
45+
4046
### `ii dav`
4147

4248
- 把任意目录挂载为网络磁盘,可由 Windows Explorer、macOS Finder 或 Linux 文件管理器直接访问。
@@ -55,6 +61,16 @@
5561
- 给支持代理配置的游戏、媒体播放器或 IoT 设备提供代理地址。
5662
- 临时比较企业网络、VPN 和家庭网络下的 DNS 与连接路径。
5763

64+
### `ii proxy`
65+
66+
- 给浏览器、下载器和其他支持 HTTP 代理的工具提供普通 HTTP 正向代理。
67+
- 让局域网设备经一台具备 VPN、特殊路由或目标网络访问能力的电脑访问网络。
68+
69+
### `ii pac`
70+
71+
- 托管 PAC 地址,让浏览器自动对内网地址直连、其余地址走指定 HTTP 或 SOCKS5 代理。
72+
- 在临时办公网、VPN 或测试网络中统一分发代理规则,不必逐台手动配置。
73+
5874
### `ii relay`
5975

6076
- 自建 Iroh relay,作为 `ii send --relay` 的指定跨网转发路径。
@@ -67,12 +83,47 @@
6783
- 让没有公网 IP 的机器被远端访问。
6884
- 用于临时远程协助,无需配置路由器端口转发。
6985

86+
### `ii tcp`
87+
88+
- 将本地监听端口转发到固定 TCP 目标,例如 SSH、数据库、开发站或内部服务。
89+
- 在测试、短期联调和端口映射场景中转发一个已知 TCP 服务。
90+
91+
### `ii udp`
92+
93+
- 将 UDP 流量转发到固定目标,适合游戏、设备发现和自定义 UDP 协议调试。
94+
- 让无法直接访问目标 UDP 服务的局域网设备经当前电脑中转。
95+
7096
### `ii discover`
7197

7298
- 扫描局域网内正在运行的 `ii` 服务。
7399
- 找到同网段的发送任务、目录站和 WebDAV 服务,不必手输 IP。
74100
- 在会议室、实验室或机房快速发现共享端点。
75101

102+
### `ii ping`
103+
104+
- 测量 TCP 建连延迟,快速判断某个服务地址是否可达、网络是否抖动。
105+
- 对比企业网络、VPN、家庭网络或不同出口下的连接质量。
106+
107+
### `ii speed`
108+
109+
- 两台设备分别运行 `ii speed serve``ii speed`,测量真实局域网上下行吞吐。
110+
- 排查 Wi-Fi 标称带宽很高但实际传文件很慢的链路问题,不依赖外网测速站。
111+
112+
### `ii wake`
113+
114+
- 向同网段休眠电脑或 NAS 发送 Wake-on-LAN 魔术包。
115+
- 在远程传文件、备份或访问前先唤醒目标设备。
116+
117+
### `ii port`
118+
119+
- 一次检查同一主机的多个 TCP 端口是否开放、拒绝或超时。
120+
- 排查防火墙、服务监听、端口映射和网络策略问题。
121+
122+
### `ii health`
123+
124+
- 检查 HTTP(S) 健康端点或裸 TCP 服务是否可用。
125+
- 持续监控服务状态,只在状态变化时输出,适合轻量值守和脚本集成。
126+
76127
## 安装
77128

78129
Linux x86_64 和 Apple Silicon macOS:
@@ -238,10 +289,33 @@ ii dav .\shared --port 8443 --username alice --password secret --tls --domain da
238289

239290
`ii web --once` 只在第一次完整的普通文件 `GET 200` 后退出;HEAD、Range、目录页、404 和上传不会消耗这次机会,且不能和 `--upload` 同用。
240291

292+
### 轻量局域网服务
293+
294+
```powershell
295+
# 只读目录站;支持浏览、Range、媒体播放和下载
296+
ii http .\public
297+
298+
# 文字剪贴板;无参数时从 stdin 读取,raw 返回纯文本
299+
ii paste "meeting code: 123456" --ttl 30m
300+
Get-Content .\note.txt -Raw | ii paste --token
301+
302+
# 纯上传收集箱;默认写到启动目录的 .\ii\
303+
ii drop .\incoming
304+
305+
# 为现有 HTTP/SOCKS5 代理托管 PAC 文件
306+
ii pac --proxy socks5://192.168.1.10:1080
307+
308+
# 局域网吞吐测试服务端和客户端
309+
ii speed serve --port 9000
310+
ii speed http://192.168.1.10:9000/ --duration 15s
311+
```
312+
313+
`ii http` 没有上传和写入接口;`ii drop` 只有多文件上传和断点续传,不列目录也不提供下载,指定目录直接作为上传目录。`ii paste` 根页可复制内容,`raw` 返回 `text/plain``--ttl` 到期自动关闭。`ii pac` 根 URL 返回 PAC 文件,内网、回环、`.local` 和无点主机名走 `DIRECT`,其他目标走指定代理。它们都支持 `--port``--bind``--token [value]`,终端输出二维码、LAN URL 和 `other:`;也会被 `ii discover` 发现。
314+
241315
### 局域网发现
242316

243317
```powershell
244-
# 列出同一 LAN 中的 ii send -t、ii web 和 ii dav
318+
# 列出同一 LAN 中的 ii send -t、web/dav 和轻量 HTTP 服务
245319
ii discover
246320
247321
# 输出 JSON Lines
@@ -317,6 +391,28 @@ ii version
317391

318392
`ii doctor --nat` 会运行一次短生命周期 UDP/NAT/relay 探测,输出实际 UDP socket、IPv4/IPv6、NAT 映射、首选 relay 和 relay 在线结果;Iroh 未公开 hairpin 探测时会明确标记为不可用。
319393

394+
## 代理、转发与网络工具
395+
396+
```powershell
397+
# HTTP 正向代理;可选 Basic 认证
398+
ii proxy --port 8080
399+
ii proxy --username alice --password secret
400+
401+
# 将本地 TCP/UDP 端口转发到固定目标
402+
ii tcp db.internal:5432 --port 15432
403+
ii udp game.internal:27015 --port 27015
404+
405+
# TCP connect 探测、端口检查、持续健康检查
406+
ii ping api.example.com:443 --count 4
407+
ii port api.example.com 80 443 8443
408+
ii health https://api.example.com/health --interval 10s
409+
410+
# 发送 Wake-on-LAN 魔术包
411+
ii wake aa:bb:cc:dd:ee:ff --broadcast 192.168.1.255
412+
```
413+
414+
`ii proxy` 支持 HTTP/1.0、HTTP/1.1 absolute-form 请求与 `CONNECT`,普通 HTTP 请求一连接一请求,不做 TLS 解密、缓存或 WebSocket 代理。`ii tcp``ii udp` 是固定目标转发器;UDP 按客户端地址维护上游会话,空闲五分钟清理。`ii ping` 是 TCP connect 延迟探测,不发送 ICMP;`ii port` 并发检查 TCP 端口;`ii health` 对 HTTP(S) 仅将 `2xx/3xx` 视为健康,或检查裸 `host:port` 的 TCP 连通性。
415+
320416
## 详细手册
321417

322418
完整命令、配置和故障排查见 [ii.md](ii.md)

SIZE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ All measurements use `cargo build -p ii --release --locked` followed by UPX
3636
| Generic S3/R2 split and Azure Blob backend | 6,413,312 | 2,436,608 | +171,008 | `cargo test -p ii --locked` (131 tests), `cargo check -p ii-gui --locked`, `cargo bloat --crates`, UPX `5.1.0 --best --lzma`, `upx -t` |
3737
| Nine low-volume extensions: checksums, metadata, queue/watch, NAT probe, symlink policy, QUIC port, and `web --once` | 6,650,368 | 2,353,152 | -83,456 | `cargo test -p ii --locked` (146 tests), fmt check, diff check, `cargo bloat -p ii --release --crates -n 15`, standard `cargo build -p ii --release --locked`, UPX `5.1.0 --best --lzma`, `upx -t` |
3838
| Path diagnostics, relay selection, resumable web upload, and SOCKS5 | 6,727,168 | 2,377,728 | +24,576 | `cargo test -p ii --locked` (157 tests), fmt check, diff check, `cargo bloat -p ii --release --crates -n 15`, standard `cargo build -p ii --release --locked`, UPX `5.1.0 --best --lzma`, `upx -t` |
39+
| Twelve lightweight network services: HTTP/paste/drop/PAC/speed, proxy/forwarding, and diagnostics | 6,866,432 | 2,576,384 | +198,656 | `cargo test -p ii --locked` (172 tests), fmt check, diff check, packed CLI help smoke test, `cargo bloat -p ii --release --crates -n 15`, standard `cargo build -p ii --release --locked`, UPX `5.1.0 --best --lzma`, `upx -t` |
3940

4041
Equivalent release rebuilds have varied by up to `3,072` UPX bytes; the latest
4142
measurement is recorded with the pinned `5.1.0` packer.

0 commit comments

Comments
 (0)