Files
ykxmz/_build/cleanup_relay.sh
T
xmz7891 b705216e4a ykxmz 1.5.0锛氫慨澶嶆墜琛ㄧ TLS 璇佷功鏍¢獙 + MTU 淇缃戠粶绋冲畾鎬?
琚帶绔?- 淇 MTU 闂锛氬す MSS + 璺緞 MTU 鎺㈡祴锛堝叕缃戝彲鐢ㄧ巼 48% -> 100%锛?- 澶嶇敤 HTTP 杩炴帴锛堝厤鎺夋瘡娆℃柊寤?TLS 鐨?30% 鎻℃墜澶辫触锛?- 姣忓垎閽熷洖澶存壘灞€鍩熺綉锛岃嚜鍔ㄥ垏鍥炲揩 400 鍊嶇殑璺緞
- 鐢婚潰蹇冭烦甯э細闈欐鏃剁渷娴侀噺锛屽鎴风浠嶇煡閬撴祦鏄椿鐨?- 閿佸睆鏃剁粰鍑哄彲鎿嶄綔鐨勬彁绀?
鎵嬭〃绔?- 鍐呯疆 GTS Root R4 / GlobalSign Root CA锛屼慨 SSLHandshakeException
- 杩炴帴閿欒缈昏瘧鎴愪汉璇濓紙璇佷功/鏃堕棿/瑙f瀽/瓒呮椂鍒嗗埆鎻愮ず锛?- 缁忎腑杞繛涓婂悗鐢ㄦ湇鍔″櫒鎶ョ殑鍦板潃鍒锋柊宸查厤瀵硅褰?- 鏂板灞€鍩熺綉杩炴帴椤甸潰銆佹湇鍔″櫒寤惰繜妫€娴?
鏈嶅姟鍣ㄧ
- 鏀寔 chunked 璇锋眰浣擄紙淇瘡 16 绉掍竴娆$殑杩炴帴閿欎贡涓庡ぇ闈㈢Н 502锛?- 缃戠粶璋冧紭鑴氭湰 net-tune.sh锛堝紑鏈鸿嚜鍔ㄥ簲鐢級
- 绠$悊椤碉細鎵归噺鍒犻櫎銆佺綉缁滀綋妫€銆佷笅杞藉尯
- 闅ч亾鏀?HTTP/2 + 鍙岃繛鎺?
鏂囨。
- 璁稿彲鍗忚 / 瀹夎鍓嶅繀璇?/ 瀹夎鍚庨』鐭ワ紙浣滆€咃細灏忛害瀛愶級
2026-10-06 19:01:05 +08:00

97 lines
3.4 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# 清理中转上的测试设备,确认用户的配对码没被占。
set -u
KEY=$(cat /root/lanremote-relay/data/admin_key.txt 2>/dev/null)
echo "===== 1. 当前中转上有哪些设备 ====="
curl -s --max-time 8 http://127.0.0.1:8080/v1/health > /tmp/h.json 2>/dev/null
python3 - <<'PY'
import json
try:
d = json.load(open('/tmp/h.json'))
except Exception:
print(" 读不到健康信息")
raise SystemExit
devices = d.get("devices", [])
if not devices:
print(" (一台都没有)")
for x in devices:
print(f" {x.get('code')} {x.get('name')} "
f"online={x.get('online')} deviceId={x.get('deviceId')}")
print(f" 共 {len(devices)} 台")
PY
echo
echo "===== 2. 抹掉测试设备(名字里带 test/测试 的)====="
python3 - <<'PY'
import json, subprocess
try:
d = json.load(open('/tmp/h.json'))
except Exception:
raise SystemExit
key = open('/root/lanremote-relay/data/admin_key.txt').read().strip()
removed = 0
for x in d.get("devices", []):
name = str(x.get("name") or "")
dev = str(x.get("deviceId") or "")
if ("test" in dev.lower() or "测试" in name or "多地址" in name):
code = x.get("code")
out = subprocess.run(
["curl", "-s", "--max-time", "8", "-X", "POST",
"http://127.0.0.1:8080/v1/admin/forget",
"-H", f"X-Admin: {key}",
"-H", "Content-Type: application/json",
"-d", json.dumps({"code": code})],
capture_output=True, text=True).stdout
print(f" 抹掉 {code} ({name}) -> {out.strip()[:60]}")
removed += 1
print(f" 共抹掉 {removed} 台")
PY
echo
echo "===== 3. 现在还有哪些 ====="
curl -s --max-time 8 http://127.0.0.1:8080/v1/health > /tmp/h2.json 2>/dev/null
python3 - <<'PY'
import json
try:
d = json.load(open('/tmp/h2.json'))
except Exception:
raise SystemExit
for x in d.get("devices", []):
print(f" {x.get('code')} {x.get('name')}")
print(f" 共 {len(d.get('devices', []))} 台")
PY
echo
echo "===== 4. 789113 能不能用 ====="
RESULT=$(curl -s --max-time 8 -X POST http://127.0.0.1:8080/v1/agent/register \
-H 'Content-Type: application/json' \
-d '{"deviceId":"probe-check-789113","code":"789113","name":"探测","version":"1.4.0"}')
echo " $RESULT" | head -c 200
echo
if echo "$RESULT" | grep -q '"ok": *true'; then
echo " ✓ 789113 可以用"
# 探测完立刻抹掉,别占着
curl -s -o /dev/null -X POST http://127.0.0.1:8080/v1/admin/forget \
-H "X-Admin: $KEY" -H 'Content-Type: application/json' \
-d '{"code":"789113"}'
echo " (探测记录已清掉,789113 现在是空闲的)"
elif echo "$RESULT" | grep -q 'codeTaken'; then
echo " ✗ 789113 被别的设备占了 —— 需要处理"
else
echo " ? 结果看不懂"
fi
echo
echo "===== 5. 服务状态 ====="
for s in lanremote-relay lanremote-tunnel lanremote-watchdog.timer; do
printf " %-30s %-9s %s\n" "$s" \
"$(systemctl is-active $s 2>/dev/null)" \
"$(systemctl is-enabled $s 2>/dev/null)"
done
echo
echo " 公网地址: $(cat /root/lanremote-relay/public_url.txt 2>/dev/null)"
echo " 可达性: HTTP $(timeout 20 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)"
echo " 内存: $(free -m | awk 'NR==2{printf "已用 %s MB / 可用 %s MB", $3, $7}')"