ykxmz 1.5.0:修复手表端 TLS 证书校验 + MTU 修复网络稳定性

被控端
- 修复 MTU 问题:夹 MSS + 路径 MTU 探测(公网可用率 48% -> 100%)
- 复用 HTTP 连接(免掉每次新建 TLS 的 30% 握手失败)
- 每分钟回头找局域网,自动切回快 400 倍的路径
- 画面心跳帧:静止时省流量,客户端仍知道流是活的
- 锁屏时给出可操作的提示

手表端
- 内置 GTS Root R4 / GlobalSign Root CA,修 SSLHandshakeException
- 连接错误翻译成人话(证书/时间/解析/超时分别提示)
- 经中转连上后用服务器报的地址刷新已配对记录
- 新增局域网连接页面、服务器延迟检测

服务器端
- 支持 chunked 请求体(修每 16 秒一次的连接错乱与大面积 502)
- 网络调优脚本 net-tune.sh(开机自动应用)
- 管理页:批量删除、网络体检、下载区
- 隧道改 HTTP/2 + 双连接

文档
- 许可协议 / 安装前必读 / 安装后须知(作者:小麦子)
This commit is contained in:
xmz7891
2026-10-06 19:01:05 +08:00
commit b62ac865ea
3195 changed files with 203292 additions and 0 deletions
+72
View File
@@ -0,0 +1,72 @@
#!/bin/bash
# 为什么只建了 1 条隧道连接?(配置是 ha-connections 2)
#
# 观察:
# 100% 那次:连接数 2
# 85% 那次:连接数 1
# -> 连接数直接决定可用率!缺一条就少一份冗余。
set -u
RELAY_DIR=/root/lanremote-relay
echo "===== 1. 现在的连接数 ====="
echo " ha_connections = $(curl -s --max-time 5 http://127.0.0.1:20241/metrics 2>/dev/null | grep '^cloudflared_tunnel_ha_connections' | awk '{print $2}')"
echo
echo "===== 2. 等 90 秒,看第二条会不会自己补上 ====="
for i in 1 2 3 4 5 6; do
sleep 15
n=$(curl -s --max-time 5 http://127.0.0.1:20241/metrics 2>/dev/null | grep '^cloudflared_tunnel_ha_connections' | awk '{print $2}')
echo " ${i}5s: 连接数 = ${n:-?}"
done
echo
echo "===== 3. 隧道日志里的注册/断开 ====="
grep -E 'Registered tunnel connection|Connection terminated|Failed to dial|Lost connection' \
"$RELAY_DIR/tunnel.log" 2>/dev/null | tail -12 | sed 's/^/ /'
echo
echo "===== 4. 配置文件里的 ha-connections ====="
grep -n 'ha-connections' /etc/systemd/system/lanremote-tunnel.service \
| sed 's/^/ /'
echo
echo "===== 5. 用 4 条连接试试(MSS 修好之后 TCP 多连接应该更从容)====="
cat > /etc/systemd/system/lanremote-tunnel.service <<'EOF'
[Unit]
Description=LanRemote Cloudflare 具名隧道
After=network-online.target lanremote-relay.service lanremote-nettune.service
Wants=network-online.target lanremote-relay.service
[Service]
Type=simple
# 协议 HTTP/2:这条线路丢 UDP 包,QUIC 撑不住(实测 48% vs 80%)
# 连接数 4:MSS 夹好之后 TCP 多连接不再互相挤,
# 缺一条还有三条顶着(实测连接数 1 时掉到 85%)
ExecStart=/usr/local/bin/cloudflared tunnel --no-autoupdate --protocol http2 --edge-ip-version 4 --ha-connections 4 --retries 5 --config /root/.cloudflared/config.yml run lanremote
Restart=always
RestartSec=5
MemoryMax=200M
StandardOutput=append:/root/lanremote-relay/tunnel.log
StandardError=append:/root/lanremote-relay/tunnel.log
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl restart lanremote-tunnel
echo " 已切到 4 条,等 60 秒…"
sleep 60
echo " 连接数 = $(curl -s --max-time 5 http://127.0.0.1:20241/metrics 2>/dev/null | grep '^cloudflared_tunnel_ha_connections' | awk '{print $2}')"
echo " 注册 $(grep -c 'Registered tunnel connection' "$RELAY_DIR/tunnel.log" 2>/dev/null || echo 0) 次"
echo
echo "===== 6. 30 次可用率 ====="
ok=0
for i in $(seq 1 30); do
c=$(timeout 12 curl -4 -s -o /dev/null -w '%{http_code}' \
-H 'User-Agent: LanRemote/1.4.0' https://relay.xxmxxs.top/v1/health 2>/dev/null)
[ "$c" = "200" ] && ok=$((ok+1))
sleep 1
done
echo " $ok/30 = $((ok * 100 / 30))%"