#!/bin/bash # 查出隧道「双协议」到底是什么状态 —— 文档要照着实际写,不能猜。 set -u echo "════════ 1. 所有隧道相关服务 ════════" for s in lanremote-tunnel lanremote-tunnel-h2 lanremote-tunnel-http2; do if systemctl list-unit-files 2>/dev/null | grep -q "^$s.service"; then printf " %-26s enabled=%-9s active=%s\n" "$s" \ "$(systemctl is-enabled $s 2>/dev/null)" \ "$(systemctl is-active $s 2>/dev/null)" else printf " %-26s (不存在)\n" "$s" fi done echo echo "════════ 2. 每个服务的完整配置 ════════" for s in lanremote-tunnel lanremote-tunnel-h2 lanremote-tunnel-http2; do if systemctl list-unit-files 2>/dev/null | grep -q "^$s.service"; then echo " ── $s ──" systemctl cat $s 2>/dev/null | grep -E 'ExecStart|Description' | sed 's/^/ /' fi done echo echo "════════ 3. 实际在跑的 cloudflared 进程 ════════" ps -eo pid,etime,cmd 2>/dev/null | grep '[c]loudflared' | sed 's/^/ /' echo echo "════════ 4. 连接数(metrics)════════" for p in 20241 20242 20243 20244; do n=$(curl -s --max-time 3 "http://127.0.0.1:$p/metrics" 2>/dev/null \ | grep '^cloudflared_tunnel_ha_connections' | awk '{print $2}') [ -n "${n:-}" ] && echo " 端口 $p: $n 条连接" done echo echo "════════ 5. 每个连接用的协议 ════════" for p in 20241 20242; do out=$(curl -s --max-time 3 "http://127.0.0.1:$p/metrics" 2>/dev/null \ | grep -oE 'protocol="[a-z0-9]+"' | sort | uniq -c) [ -n "${out:-}" ] && { echo " 端口 $p:"; echo "$out" | sed 's/^/ /'; } done echo echo "════════ 6. 服务端 zip 里有哪些部署脚本 ════════" ls -1 /root/lanremote-relay/*.sh 2>/dev/null | sed 's/^/ /' echo echo "════════ 7. deploy.sh 里对隧道服务的处理(关键行)════════" grep -nE 'lanremote-tunnel|tunnel-h2|--protocol|ha-connections' \ /root/lanremote-relay/deploy.sh 2>/dev/null | head -30 | sed 's/^/ /' echo echo "════════ 8. deploy-tune.sh 里对隧道/MTU 的处理 ════════" grep -nE 'mtu|MSS|mss|protocol|quic|keepalive' \ /root/lanremote-relay/deploy-tune.sh 2>/dev/null | head -25 | sed 's/^/ /'