mirror of
https://gitee.com/xmz7891/ykxmz.git
synced 2026-10-18 19:30:42 +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 + 鍙岃繛鎺? 鏂囨。 - 璁稿彲鍗忚 / 瀹夎鍓嶅繀璇?/ 瀹夎鍚庨』鐭ワ紙浣滆€咃細灏忛害瀛愶級
76 lines
2.6 KiB
Python
76 lines
2.6 KiB
Python
# -*- coding: utf-8 -*-
|
||
"""防止「源码模式跑修复,把打包版的程序级放行规则冲掉」。
|
||
|
||
真机事故链:
|
||
打包版安装的规则本来是对的(指向 LanRemote-Agent.exe)。
|
||
之后有人从源码模式(sys.executable = python.exe)跑了一次修复,
|
||
于是 App 规则被改写成 python.exe,
|
||
打包版 EXE 从此没有程序级放行 → Windows 又给它建阻止规则 → 又连不上。
|
||
|
||
修法:修复脚本的目标程序改用 target_executable():
|
||
* 打包运行时 -> 就是自己(正确)
|
||
* 源码运行时 -> 如果机器上已有指向某个 EXE 的规则且文件还在,
|
||
就沿用那个目标,不动打包版
|
||
"""
|
||
from __future__ import annotations
|
||
|
||
import ast
|
||
import sys
|
||
from pathlib import Path
|
||
|
||
ROOT = Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote")
|
||
FIREWALL = ROOT / "windows" / "lanremote" / "firewall.py"
|
||
|
||
OLD = '''def app_rule_exists() -> bool:'''
|
||
|
||
NEW = '''def target_executable() -> str:
|
||
"""修复脚本应该放行哪个程序。
|
||
|
||
正常情况下就是当前进程自己(打包后 sys.executable 是 EXE)。
|
||
但源码模式下它是 python.exe —— 如果机器上已经有一条指向打包版 EXE
|
||
的程序级放行规则,就沿用那个目标,避免源码模式跑一次修复
|
||
把打包版的规则冲掉(真机上就这么踩过一次)。
|
||
"""
|
||
current = executable_path()
|
||
if getattr(sys, "frozen", False):
|
||
return current
|
||
existing = app_rule_program()
|
||
base = os.path.basename(existing or "").lower()
|
||
if (existing and base.endswith(".exe") and "python" not in base
|
||
and os.path.isfile(existing)):
|
||
return existing
|
||
return current
|
||
|
||
|
||
def app_rule_exists() -> bool:'''
|
||
|
||
OLD_BUILD = ''' exe = executable_path()'''
|
||
NEW_BUILD = ''' exe = target_executable()'''
|
||
|
||
|
||
def main() -> int:
|
||
text = FIREWALL.read_text(encoding="utf-8")
|
||
ok = True
|
||
for old, new, tag in ((OLD, NEW, "target_executable"), (OLD_BUILD, NEW_BUILD, "build_script 目标")):
|
||
if old not in text:
|
||
print(f" [失败] {tag} 锚点未匹配")
|
||
ok = False
|
||
else:
|
||
text = text.replace(old, new, 1)
|
||
|
||
if ok:
|
||
FIREWALL.write_text(text, encoding="utf-8")
|
||
print(" firewall.py: 已加 target_executable(),修复不再冲掉打包版规则")
|
||
|
||
try:
|
||
ast.parse(FIREWALL.read_text(encoding="utf-8"))
|
||
print(" 语法: OK")
|
||
except SyntaxError as exc:
|
||
print(f" 语法错误: {exc}")
|
||
ok = False
|
||
return 0 if ok else 1
|
||
|
||
|
||
if __name__ == "__main__":
|
||
sys.exit(main())
|