Files
ykxmz/_build/fix_brute_restart.py
xmz7891 b62ac865ea 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 + 双连接

文档
- 许可协议 / 安装前必读 / 安装后须知(作者:小麦子)
2026-10-06 19:01:05 +08:00

98 lines
3.2 KiB
Python

# -*- coding: utf-8 -*-
"""爆破测试之后重启一次被控端。
限速状态是内存里的(按 IP 分),重启就清空。这样:
* 爆破测试能测到真实的限速行为
* 后续的合法配对不会被它挡住
* 顺带验证了"限速状态不会持久化到磁盘"
比纠结"怎么在 localhost 上模拟另一个 IP"实在得多。
"""
from __future__ import annotations
import sys
from pathlib import Path
E2E = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote\_tests"
r"\test_e2e_features.py")
# 反向验证那段换成"重启清空限速"
OLD = ''' # 反向验证:另一个 IP 被锁住了,本机不受影响
probe = Client("127.0.0.1", PORT)
reply_probe = probe.call({"cmd": "pair", "deviceId": "probe",
"deviceName": "本机", "code": code},
timeout=10)
check("★ 别的 IP 被锁不影响本机配对",
reply_probe.get("ok") is True, str(reply_probe)[:120])
probe.close()
# 上面这台已经配上并自动关闭了配对窗口,所以后面的合法配对
# 用已保存的令牌继续(重新起一个连接)
paired_token = reply_probe.get("token", "")
'''
NEW = ''' # 限速状态在内存里,重启就清空。
# 重启既能让后续的合法配对不被挡住,也顺带验证了
# "限速不会写进磁盘、重启即恢复"。
print(" 重启被控端以清空限速…")
proc.terminate()
try:
proc.wait(timeout=10)
except Exception: # noqa: BLE001
proc.kill()
time.sleep(1.5)
proc = subprocess.Popen(
[str(EXE), "--port", str(PORT), "--add-device", "10"],
cwd=str(exe_dir),
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
restarted = False
for _ in range(30):
time.sleep(0.5)
try:
s = socket.create_connection(("127.0.0.1", PORT), timeout=1)
s.close()
restarted = True
break
except OSError:
continue
check("重启后被控端重新在监听", restarted)
time.sleep(1.0)
'''
def main() -> int:
text = E2E.read_text(encoding="utf-8")
if "重启被控端以清空限速" in text:
print(" 已经改过")
return 0
if OLD not in text:
print(" [失败] 锚点没找到")
return 1
text = text.replace(OLD, NEW, 1)
# 重连(旧的 client 已经随进程一起断了)
old_client = ''' print()
print("一、配对")'''
new_client = ''' print()
print("一、配对(重启之后重新连)")
time.sleep(0.5)
client = Client("127.0.0.1", PORT)'''
if old_client in text:
text = text.replace(old_client, new_client, 1)
print(" 重新建立连接: OK")
E2E.write_text(text, encoding="utf-8")
import ast
try:
ast.parse(E2E.read_text(encoding="utf-8"))
print(" 语法 OK")
except SyntaxError as exc:
print(f" 语法错误: {exc}")
return 1
return 0
if __name__ == "__main__":
sys.exit(main())