Skip to content

Commit d7175ea

Browse files
committed
fix: stabilize socks5 connections
1 parent 6fcdaa9 commit d7175ea

9 files changed

Lines changed: 279 additions & 50 deletions

File tree

CHANGELOG.en.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

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

5+
## 0.3.11 - 2026-08-11
6+
7+
### Changed
8+
9+
- Domain `CONNECT` requests in `ii socks5` now concurrently try every DNS address within one 30-second deadline. When full, new TCP connections remain in the listener backlog until capacity is available instead of being immediately closed by the application.
10+
- `ii socks5` now explicitly warns on non-loopback listeners that SOCKS5 traffic and RFC 1929 username/password authentication are plaintext. A bare public SOCKS5 listener can be scanned or disrupted by the network path; use `ii proxy --tls`, a VPN, or an SSH tunnel for encrypted public proxy access.
11+
512
## 0.3.10 - 2026-08-11
613

714
### Added

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

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

5+
## 0.3.11 - 2026-08-11
6+
7+
### 变更
8+
9+
- `ii socks5` 的域名 `CONNECT` 现在会在同一 30 秒总时限内并发尝试 DNS 返回的全部地址;满额时新 TCP 连接留在监听队列等待容量释放,不再被应用层立即关闭。
10+
- 非回环监听的 `ii socks5` 现在明确警告:SOCKS5 流量和 RFC 1929 用户名密码认证均为明文。公网裸 SOCKS5 可能被扫描或被网络路径干扰;需要加密公网代理时使用 `ii proxy --tls`、VPN 或 SSH 隧道。
11+
512
## 0.3.10 - 2026-08-11
613

714
### 新增

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
@@ -24,7 +24,7 @@ unused-async = "warn"
2424

2525
[package]
2626
name = "ii"
27-
version = "0.3.10"
27+
version = "0.3.11"
2828
edition.workspace = true
2929
rust-version.workspace = true
3030
license.workspace = true

README.en.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,9 @@ ii socks5
303303
ii socks5 --port 1080 --username alice --password secret
304304
```
305305

306-
`ii socks5` is a standalone ordinary network proxy. It listens on a random `0.0.0.0` port by default and prints the actual address. It supports SOCKS5 `CONNECT`, `UDP ASSOCIATE`, `BIND`, IPv4, IPv6, and domain targets. It does not use Iroh, tickets, or relays. Supplying `--username` and `--password` enables SOCKS5 username/password authentication; both options are required together. To prevent public half-open connections from exhausting resources, it defaults to 100 active connections, a 10-second handshake deadline, and a 5-minute idle `CONNECT` tunnel timeout; use `--max`, `--handshake-timeout`, and `--idle-timeout` to adjust them.
306+
`ii socks5` is a standalone ordinary network proxy. It listens on a random `0.0.0.0` port by default and prints the actual address. It supports SOCKS5 `CONNECT`, `UDP ASSOCIATE`, `BIND`, IPv4, IPv6, and domain targets. It does not use Iroh, tickets, or relays. For a domain `CONNECT`, it concurrently tries every address returned by the proxy-side DNS resolver within one 30-second deadline. Supplying `--username` and `--password` enables SOCKS5 username/password authentication; both options are required together. To prevent public half-open connections from exhausting resources, it defaults to 100 active connections, a 10-second handshake deadline, and a 5-minute idle `CONNECT` tunnel timeout. When `--max` is full, new TCP connections remain in the listener backlog until capacity becomes available instead of being immediately closed by the application.
307+
308+
SOCKS5 traffic and RFC 1929 username/password authentication are plaintext. Authentication restricts access but does not encrypt it. A bare public SOCKS5 listener can be scanned or disrupted by the network path; it cannot promise to bypass protocol detection or interference. For encrypted public proxy access, use the existing `ii proxy --tls`, a VPN, or an SSH tunnel.
307309

308310
### Self-hosted Relay
309311

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,9 @@ ii socks5
303303
ii socks5 --port 1080 --username alice --password secret
304304
```
305305

306-
`ii socks5` 是独立的普通网络代理,默认监听 `0.0.0.0` 的随机端口并打印实际地址。支持 SOCKS5 `CONNECT``UDP ASSOCIATE``BIND`、IPv4、IPv6 和域名目标;不经过 Iroh、ticket 或 relay。提供 `--username``--password` 时启用 SOCKS5 用户名密码认证,两个参数必须成对出现。为避免公网半开连接耗尽资源,默认最多 100 个活动连接,10 秒内必须完成握手,`CONNECT` 隧道连续 5 分钟无数据会关闭;可用 `--max``--handshake-timeout``--idle-timeout` 调整。
306+
`ii socks5` 是独立的普通网络代理,默认监听 `0.0.0.0` 的随机端口并打印实际地址。支持 SOCKS5 `CONNECT``UDP ASSOCIATE``BIND`、IPv4、IPv6 和域名目标;不经过 Iroh、ticket 或 relay。`CONNECT` 的域名目标会在同一个 30 秒总时限内并发尝试代理端 DNS 返回的全部地址。提供 `--username``--password` 时启用 SOCKS5 用户名密码认证,两个参数必须成对出现。为避免公网半开连接耗尽资源,默认最多 100 个活动连接,10 秒内必须完成握手,`CONNECT` 隧道连续 5 分钟无数据会关闭;达到 `--max` 时,新的 TCP 连接留在监听队列中等待容量释放,而不会被应用层立即关闭。
307+
308+
SOCKS5 流量和 RFC 1929 用户名密码认证均为明文,认证只限制访问,不提供加密。裸 SOCKS5 暴露到公网可能被扫描或被网络路径干扰,不能保证绕过协议识别或干扰;需要加密公网代理时,使用现有 `ii proxy --tls`、VPN 或 SSH 隧道。
307309

308310
### 自建 Relay
309311

ii.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,11 @@ ii socks5 --bind 192.168.1.20 --username alice --password secret
372372

373373
`ii socks5` 是普通 SOCKS5 网络代理,不经过 Iroh、ticket 或 relay。默认监听 `0.0.0.0` 的随机端口,终端打印实际监听地址;`--port <port>` 固定端口,`--bind <ip>` 指定 IPv4 或 IPv6 监听地址。
374374

375-
支持 SOCKS5 `CONNECT``UDP ASSOCIATE``BIND`,以及 IPv4、IPv6 和域名目标。域名由代理端解析。没有认证参数时使用 SOCKS5 无认证方式;`--username <user>``--password <pass>` 必须成对提供,提供后只接受 RFC 1929 用户名密码认证。
375+
支持 SOCKS5 `CONNECT``UDP ASSOCIATE``BIND`,以及 IPv4、IPv6 和域名目标。域名由代理端解析`CONNECT` 会在一个 30 秒总时限内并发尝试 DNS 返回的全部地址。`BIND``UDP ASSOCIATE` 保持各自既有语义。没有认证参数时使用 SOCKS5 无认证方式;`--username <user>``--password <pass>` 必须成对提供,提供后只接受 RFC 1929 用户名密码认证。
376376

377-
默认最多保留 100 个活动连接,客户端必须在 10 秒内完成 SOCKS5 握手,`CONNECT` 隧道连续 5 分钟没有任意方向的数据即关闭。`--max <n>``--handshake-timeout <duration>``--idle-timeout <duration>` 可覆盖这些默认值;时长接受 `500ms``2s``5m``1h`
377+
默认最多保留 100 个活动连接,客户端必须在 10 秒内完成 SOCKS5 握手,`CONNECT` 隧道连续 5 分钟没有任意方向的数据即关闭。达到 `--max` 后,新 TCP 连接保持在监听队列中,直到容量释放或客户端自身超时,不会由应用层立即关闭。`--max <n>``--handshake-timeout <duration>``--idle-timeout <duration>` 可覆盖这些默认值;时长接受 `500ms``2s``5m``1h`
378+
379+
SOCKS5 流量和 RFC 1929 用户名密码认证均为明文。用户名密码只提供认证,不提供加密;裸 SOCKS5 暴露到公网可能被扫描或被网络路径干扰,不能保证绕过协议识别或干扰。需要加密公网代理时,使用现有 `ii proxy --tls`、VPN 或 SSH 隧道。
378380

379381
## 代理、转发与网络工具
380382

src/cli/help.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,12 @@ Options:
200200
--max <n> Maximum active connections; defaults to 100
201201
--handshake-timeout <d> SOCKS5 handshake deadline; defaults to 10s
202202
--idle-timeout <d> Close a CONNECT tunnel with no traffic; defaults to 5m
203+
204+
Notes:
205+
Domain CONNECT requests try every DNS address within one 30s deadline.
206+
When --max is full, new TCP connections wait in the listener backlog.
207+
SOCKS5 traffic and RFC 1929 username/password authentication are unencrypted.
208+
For encrypted public access, use ii proxy --tls, a VPN, or an SSH tunnel.
203209
";
204210

205211
pub(crate) const HTTP_HELP: &str = "\

0 commit comments

Comments
 (0)