|
@@ -682,15 +682,6 @@ async def amain(args) -> int:
|
|
|
if args.child_http:
|
|
if args.child_http:
|
|
|
return await child_http_mode(args.child_http, args.child_timeout)
|
|
return await child_http_mode(args.child_http, args.child_timeout)
|
|
|
|
|
|
|
|
- if args.mode in ("tcp", "all"):
|
|
|
|
|
- _host, _port, _path, is_https = parse_url(args.http_url)
|
|
|
|
|
- if is_https:
|
|
|
|
|
- print("TCP 测试已跳过:transparent TCP 基线不支持使用 https:// 目标做有效对比")
|
|
|
|
|
- print("建议改用可快速返回的 http:// 目标,例如:")
|
|
|
|
|
- print(" --http-url http://connectivitycheck.gstatic.com/generate_204")
|
|
|
|
|
- if args.mode == "tcp":
|
|
|
|
|
- return 0
|
|
|
|
|
-
|
|
|
|
|
config = Config.load(args.config) if args.config and Path(args.config).exists() else None
|
|
config = Config.load(args.config) if args.config and Path(args.config).exists() else None
|
|
|
proxy: tuple[str, int] | None = None
|
|
proxy: tuple[str, int] | None = None
|
|
|
if config is not None and config.socks_port > 0:
|
|
if config is not None and config.socks_port > 0:
|
|
@@ -705,13 +696,15 @@ async def amain(args) -> int:
|
|
|
print(f" SOCKS: {proxy[0]}:{proxy[1]}" if proxy else " SOCKS: 未配置或未启动")
|
|
print(f" SOCKS: {proxy[0]}:{proxy[1]}" if proxy else " SOCKS: 未配置或未启动")
|
|
|
print(f" Transparent 排除用户: {args.runtime_user}")
|
|
print(f" Transparent 排除用户: {args.runtime_user}")
|
|
|
print(" 说明: TCP 比较的是“直连基线 vs transparent_edge 实际链路”,UDP 比较的是“直连 vs socks_edge 实际链路”")
|
|
print(" 说明: TCP 比较的是“直连基线 vs transparent_edge 实际链路”,UDP 比较的是“直连 vs socks_edge 实际链路”")
|
|
|
|
|
+ if args.http_url.startswith("https://"):
|
|
|
|
|
+ print(" 提示: 当前 TCP 目标是 HTTPS,更适合做“网页体验参考”;如果要看透明首包纯开销,仍建议使用 http:// 目标")
|
|
|
print("")
|
|
print("")
|
|
|
|
|
|
|
|
tcp_pct = None
|
|
tcp_pct = None
|
|
|
udp_pct = None
|
|
udp_pct = None
|
|
|
script_path = Path(__file__).resolve()
|
|
script_path = Path(__file__).resolve()
|
|
|
|
|
|
|
|
- if args.mode in ("tcp", "all") and args.http_url.startswith("http://"):
|
|
|
|
|
|
|
+ if args.mode in ("tcp", "all"):
|
|
|
tcp_pct = await bench_tcp_transparent(args, script_path)
|
|
tcp_pct = await bench_tcp_transparent(args, script_path)
|
|
|
print("")
|
|
print("")
|
|
|
if args.mode in ("udp", "all"):
|
|
if args.mode in ("udp", "all"):
|
|
@@ -738,7 +731,7 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
parser.add_argument("--config", default="/home/mynetspeeder/config.json", help="配置文件路径")
|
|
parser.add_argument("--config", default="/home/mynetspeeder/config.json", help="配置文件路径")
|
|
|
parser.add_argument("--proxy-host", default="", help="SOCKS5 地址,默认读取 config.json")
|
|
parser.add_argument("--proxy-host", default="", help="SOCKS5 地址,默认读取 config.json")
|
|
|
parser.add_argument("--proxy-port", type=int, default=0, help="SOCKS5 端口,默认读取 config.json")
|
|
parser.add_argument("--proxy-port", type=int, default=0, help="SOCKS5 端口,默认读取 config.json")
|
|
|
- parser.add_argument("--http-url", default="http://connectivitycheck.gstatic.com/generate_204", help="TCP/透明链路测试 URL,建议使用 http://")
|
|
|
|
|
|
|
+ parser.add_argument("--http-url", default="https://spectrum.ieee.org/", help="TCP/透明链路测试 URL,可用 https:// 做网页体验参考")
|
|
|
parser.add_argument("--dns-server", default="8.8.8.8:53", help="UDP/SOCKS 链路 DNS 目标,格式 host:port")
|
|
parser.add_argument("--dns-server", default="8.8.8.8:53", help="UDP/SOCKS 链路 DNS 目标,格式 host:port")
|
|
|
parser.add_argument("--mode", choices=("tcp", "udp", "all"), default="all", help="只测 TCP、只测 UDP 或都测")
|
|
parser.add_argument("--mode", choices=("tcp", "udp", "all"), default="all", help="只测 TCP、只测 UDP 或都测")
|
|
|
parser.add_argument("--count", type=int, default=4, help="每类测试样本数,默认 4")
|
|
parser.add_argument("--count", type=int, default=4, help="每类测试样本数,默认 4")
|