mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 16:00:43 +00:00
琚帶绔?- 淇 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 + 鍙岃繛鎺? 鏂囨。 - 璁稿彲鍗忚 / 瀹夎鍓嶅繀璇?/ 瀹夎鍚庨』鐭ワ紙浣滆€咃細灏忛害瀛愶級
72 lines
2.2 KiB
Python
72 lines
2.2 KiB
Python
# -*- 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())
|