#!/bin/bash # 恢复成 A 组(quic 8 + http2 2)—— task-3 要求跑完保持现状 set -u MAIN=/etc/systemd/system/lanremote-tunnel.service H2=/etc/systemd/system/lanremote-tunnel-h2.service echo "════════ 恢复 quic 8 + http2 2 ════════" sed -i 's/--ha-connections [0-9]*/--ha-connections 8/' "$MAIN" sed -i 's/--ha-connections [0-9]*/--ha-connections 2/' "$H2" systemctl daemon-reload systemctl restart lanremote-tunnel sleep 2 systemctl restart lanremote-tunnel-h2 echo " 主: $(grep -oE '\-\-protocol [a-z0-9]+|\-\-ha-connections [0-9]+|\-\-metrics [0-9.:]+' "$MAIN" | tr '\n' ' ')" echo " 副: $(grep -oE '\-\-protocol [a-z0-9]+|\-\-ha-connections [0-9]+|\-\-metrics [0-9.:]+' "$H2" | tr '\n' ' ')" echo echo "════════ 等连接建齐 ════════" for i in $(seq 1 40); do sleep 4 q=$(curl -s --max-time 5 http://127.0.0.1:20241/metrics 2>/dev/null | grep '^cloudflared_tunnel_ha_connections' | awk '{print $2}') h=$(curl -s --max-time 5 http://127.0.0.1:20242/metrics 2>/dev/null | grep '^cloudflared_tunnel_ha_connections' | awk '{print $2}') q=${q:-0}; h=${h:-0} [ $((q + h)) -ge 8 ] && break done echo " quic=$q http2=$h 合计=$((q + h))" echo echo "════════ 公网确认 ════════" for i in $(seq 1 15); do c=$(curl -s -o /dev/null -w '%{http_code}' --max-time 15 -H 'User-Agent: LanRemote/1.8.2' https://relay.xxmxxs.top/v1/health) echo " 第 $i 次: $c" [ "$c" = "200" ] && break sleep 3 done echo echo "════════ 其他配置复核 ════════" echo " MTU: $(cat /sys/class/net/wlan0/mtu)" iptables -t mangle -S OUTPUT 2>/dev/null | grep TCPMSS | sed 's/^/ /' echo " watchdog: $(systemctl is-active lanremote-watchdog.timer) $(wc -l < /root/lanremote-relay/watchdog.sh) 行" grep -E '^THRESHOLD' /root/lanremote-relay/watchdog.sh | sed 's/^/ /' echo " relay 长轮询: $(grep -oE 'RELAY_POLL=[0-9]+' /etc/systemd/system/lanremote-relay.service 2>/dev/null)" echo " relay 版本: $(curl -s --max-time 10 http://127.0.0.1:8080/v1/health | python3 -c 'import sys,json; print(json.load(sys.stdin).get("version"))' 2>/dev/null)"