server_config: CONNECT 出站超时 60s→10s,并补充排障口径
实测(2026-09):目标为黑洞 IP 时,nginx 出站超时 60s > lite 客户端 15s, 表现为客户端 'read operation timed out' 而非 502,形似代理卡死,实为超时错配。 改为 10s 后黑洞目标 10.2s 返回、正常目标 0.4-0.7s 不受影响(五节点已生效)。 README 新增 5.6 节:三个超时的口径 + 'CONNECT 502' 的排查顺序 (先判断目标是否本身不可达 → 再看 nginx 错误类型 → 最后才怀疑 CONNECT 模块), 并建议客户端日志记录原始域名(案例:Dropbox 旧 IP 失效导致误判)。
This commit is contained in:
@@ -310,6 +310,31 @@ magic 地址 → `127.0.0.1:15201`,其余 CONNECT 走 `$connect_addr` 默认
|
|||||||
请求头 `| isConnect u8 | ATYP u8 | address | port u16be |`,
|
请求头 `| isConnect u8 | ATYP u8 | address | port u16be |`,
|
||||||
connect 模式帧 `| length u16be | data |`,non-connect 帧每帧自带目标地址。
|
connect 模式帧 `| length u16be | data |`,non-connect 帧每帧自带目标地址。
|
||||||
|
|
||||||
|
### 5.6 CONNECT 超时口径(避免客户端"卡死")
|
||||||
|
|
||||||
|
三个超时要按"客户端最没耐心"来配:
|
||||||
|
|
||||||
|
| 项 | 值 | 说明 |
|
||||||
|
|---|---|---|
|
||||||
|
| `proxy_connect_connect_timeout` | **10s** | 出站连接目标;须 < 客户端超时(lite 客户端 15s) |
|
||||||
|
| `proxy_connect_read_timeout` / `send_timeout` | 10m | 隧道空闲超时(UoT 长连接需要;注意与 data_timeout 同槽位) |
|
||||||
|
|
||||||
|
**典型故障**:目标 IP 是黑洞(不发 RST)时,若 nginx 出站超时设 60s 而客户端 15s 超时,
|
||||||
|
客户端会表现为 `The read operation timed out` 而不是收到 502 —— 看起来像"代理卡死",
|
||||||
|
实际是超时错配。2026-09 实测:改为 10s 后,黑洞目标从 >25s 降至 10.2s 返回,
|
||||||
|
正常目标(0.4~0.7s)不受影响。
|
||||||
|
|
||||||
|
**排查"CONNECT 502"的正确顺序**(重要):
|
||||||
|
1. 先看目标是否**本身就不可达**——从多个网络(国内/日本/美国/香港)实测该 IP:端口,
|
||||||
|
若都失败则是目标问题(服务下线/过期 IP/黑洞),不是代理问题;
|
||||||
|
2. 再看 nginx error.log:`Connection refused` / `timed out` / `Network is unreachable`
|
||||||
|
分别对应目标拒绝、目标黑洞、路由不可达;
|
||||||
|
3. 最后才怀疑 CONNECT 模块本身。
|
||||||
|
|
||||||
|
> 客户端日志只记 IP 不记域名时,无法判断"是不是 DNS 过期解析"。
|
||||||
|
> 建议客户端日志同时记录原始域名(实测案例:某 Dropbox 旧 IP 已失效,
|
||||||
|
> 域名现已解析到其它地址,客户端仍在拨旧 IP)。
|
||||||
|
|
||||||
## 6. sing-box(VLESS+REALITY / Shadowsocks)
|
## 6. sing-box(VLESS+REALITY / Shadowsocks)
|
||||||
|
|
||||||
### 6.1 安装
|
### 6.1 安装
|
||||||
|
|||||||
@@ -58,7 +58,9 @@ http {
|
|||||||
proxy_connect;
|
proxy_connect;
|
||||||
proxy_connect_allow all;
|
proxy_connect_allow all;
|
||||||
proxy_connect_address $rrpp_uot_connect_address;
|
proxy_connect_address $rrpp_uot_connect_address;
|
||||||
proxy_connect_connect_timeout 60s;
|
# 出站连接超时须小于客户端超时(lite 客户端 15s):
|
||||||
|
# 目标黑洞时快速返回 502,避免客户端"read operation timed out"干等
|
||||||
|
proxy_connect_connect_timeout 10s;
|
||||||
# 注:此模块版本 proxy_connect_data_timeout 与 proxy_connect_read_timeout
|
# 注:此模块版本 proxy_connect_data_timeout 与 proxy_connect_read_timeout
|
||||||
# 写同一字段(同时配置报 duplicate),长连接超时用 read/send timeout 设置
|
# 写同一字段(同时配置报 duplicate),长连接超时用 read/send timeout 设置
|
||||||
proxy_connect_read_timeout 10m;
|
proxy_connect_read_timeout 10m;
|
||||||
@@ -109,7 +111,9 @@ http {
|
|||||||
proxy_connect;
|
proxy_connect;
|
||||||
proxy_connect_allow all;
|
proxy_connect_allow all;
|
||||||
proxy_connect_address $rrpp_uot_connect_address;
|
proxy_connect_address $rrpp_uot_connect_address;
|
||||||
proxy_connect_connect_timeout 60s;
|
# 出站连接超时须小于客户端超时(lite 客户端 15s):
|
||||||
|
# 目标黑洞时快速返回 502,避免客户端"read operation timed out"干等
|
||||||
|
proxy_connect_connect_timeout 10s;
|
||||||
# 注:此模块版本 proxy_connect_data_timeout 与 proxy_connect_read_timeout
|
# 注:此模块版本 proxy_connect_data_timeout 与 proxy_connect_read_timeout
|
||||||
# 写同一字段(同时配置报 duplicate),长连接超时用 read/send timeout 设置
|
# 写同一字段(同时配置报 duplicate),长连接超时用 read/send timeout 设置
|
||||||
proxy_connect_read_timeout 10m;
|
proxy_connect_read_timeout 10m;
|
||||||
|
|||||||
Reference in New Issue
Block a user