Files
ykxmz/_tests/audit_python_names.py
T
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

72 lines
2.2 KiB
Python
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.
# -*- coding: utf-8 -*-
"""用 pyflakes 静态检查所有 Python 源码。
为什么必须加这一层:
我加 check_code_available() 时用了 DEFAULT_RELAY_URL,
但那个常量定义在 server.py、run_agent.py 里没导入。
结果:安装到最后一步直接弹 NameError 崩溃。
自带的回归全绿、编码审计也过 —— 因为这是**运行到那行才炸**的问题。
pyflakes 是静态分析,扫一眼就能发现"用了没定义的名字"。
本机自带 pyflakes 4.0.2。没有的话就跳过(不阻塞)。
"""
from __future__ import annotations
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
TARGETS = (
list((ROOT / "windows").glob("*.py"))
+ list((ROOT / "windows" / "lanremote").glob("*.py"))
+ list((ROOT / "relay").glob("*.py"))
+ list((ROOT / "_build").glob("*.py"))
+ list((ROOT / "_tests").glob("*.py"))
)
def main() -> int:
try:
import pyflakes # noqa: F401
except ImportError:
print(" (本机没有 pyflakes,跳过)")
return 0
files = [str(p) for p in TARGETS if p.is_file()]
print(f" 检查 {len(files)} 个 Python 文件…")
proc = subprocess.run([sys.executable, "-m", "pyflakes"] + files,
capture_output=True, text=True,
encoding="utf-8", errors="replace")
lines = [line for line in (proc.stdout or "").splitlines() if line.strip()]
if not lines:
print(" ✓ 没有未定义名 / 未使用导入等问题")
return 0
# 分类:undefined name 是致命的,未使用导入是无害的
fatal = [line for line in lines if "undefined name" in line]
minor = [line for line in lines if line not in fatal]
if minor:
print(f" {len(minor)} 条小问题(未使用的导入/变量,不影响运行):")
for line in minor[:8]:
print(f" {line}")
if fatal:
print()
print(f" ✗ {len(fatal)} 条**未定义名**(运行到这行会 NameError):")
for line in fatal:
print(f" {line}")
return 1
print(" ✓ 没有会导致崩溃的问题")
return 0
if __name__ == "__main__":
sys.exit(main())