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
+110
View File
@@ -0,0 +1,110 @@
#!/bin/bash
# 决定性对比:找出最能扛的隧道配置。
#
# 现状:http2 + ha=2 大约 60~75% 可用。剩下 25% 失败的原因是
# 到 Cloudflare 美西边缘(sjc/lax)的国际链路丢包。
#
# 单协议单通道扛不住,那就试三套:
# A) http2 + ha=2 现状
# B) http2 + ha=4 TCP 下多连接不像 UDP 那样互相挤
# C) http2 ha=1 + quic ha=1 两个进程、两种协议同时挂着
# —— Cloudflare 会在所有连接间分发请求,
# 哪个协议当下能通就走哪个
set -u
URL=https://relay.xxmxxs.top
RELAY_DIR=/root/lanremote-relay
UNIT=/etc/systemd/system/lanremote-tunnel.service
stop_all() {
systemctl stop lanremote-tunnel 2>/dev/null || true
systemctl stop lanremote-tunnel-quic 2>/dev/null || true
pkill -f cloudflared 2>/dev/null || true
sleep 3
}
write_unit() {
local name="$1" exec_args="$2"
cat > "/etc/systemd/system/$name.service" <<EOF
[Unit]
Description=LanRemote 隧道($name)
After=network-online.target lanremote-relay.service
Wants=network-online.target lanremote-relay.service
[Service]
Type=simple
ExecStart=/usr/local/bin/cloudflared tunnel $exec_args
Restart=always
RestartSec=5
MemoryMax=160M
StandardOutput=append:/root/lanremote-relay/tunnel.log
StandardError=append:/root/lanremote-relay/tunnel.log
[Install]
WantedBy=multi-user.target
EOF
}
measure() {
local label="$1"
local ok=0 bad=0 i code
for i in $(seq 1 40); do
code=$(timeout 12 curl -4 -s -o /dev/null -w '%{http_code}' \
-H 'User-Agent: LanRemote/1.4.0' "$URL/v1/health" 2>/dev/null)
code=${code:-000}
[ "$code" = "200" ] && ok=$((ok + 1)) || bad=$((bad + 1))
sleep 2
done
local conns
conns=$(curl -s --max-time 5 http://127.0.0.1:20241/metrics 2>/dev/null \
| grep '^cloudflared_tunnel_ha_connections' | awk '{print $2}')
local pct=$((ok * 100 / (ok + bad)))
printf " >>> %-18s 可用 %2d/%2d (%d%%) 连接数=%s\n" \
"$label" "$ok" "$((ok + bad))" "$pct" "${conns:-?}"
echo "$label|$pct|${conns:-0}" >> /root/net_ab.txt
return 0
}
: > /root/net_ab.txt
CFG="--no-autoupdate --edge-ip-version 4 --retries 5 --config /root/.cloudflared/config.yml run lanremote"
echo "===== A) http2 + ha=2(现状)====="
stop_all
: > "$RELAY_DIR/tunnel.log"
write_unit lanremote-tunnel "$CFG --protocol http2 --ha-connections 2"
systemctl daemon-reload
systemctl start lanremote-tunnel
echo " 等 40 秒…"; sleep 40
measure "http2 ha=2"
echo
echo "===== B) http2 + ha=4 ====="
stop_all
: > "$RELAY_DIR/tunnel.log"
write_unit lanremote-tunnel "$CFG --protocol http2 --ha-connections 4"
systemctl daemon-reload
systemctl start lanremote-tunnel
echo " 等 40 秒…"; sleep 40
measure "http2 ha=4"
echo
echo "===== C) http2 ha=1 + quic ha=1(双进程双协议)====="
stop_all
: > "$RELAY_DIR/tunnel.log"
write_unit lanremote-tunnel "$CFG --protocol http2 --ha-connections 1"
write_unit lanremote-tunnel-quic "$CFG --protocol quic --ha-connections 1"
systemctl daemon-reload
systemctl start lanremote-tunnel
systemctl start lanremote-tunnel-quic
echo " 等 50 秒…"; sleep 50
measure "http2+quic 双协议"
echo
echo "===== 汇总 ====="
printf " %-20s %s\n" "配置" "可用率"
while IFS='|' read -r label pct conns; do
printf " %-20s %s%% (连接 %s)\n" "$label" "$pct" "$conns"
done < /root/net_ab.txt
echo
best=$(sort -t'|' -k2 -rn /root/net_ab.txt | head -1 | cut -d'|' -f1)
echo " 最优:$best"