refactor(proxy-node): 统一代理解析,全面支持 tunnel 模式

新增 resolve_ops_proxy_config 合并 proxy 和 tunnel_node_id 的解析,
避免各架构重复调用 _resolve_effective_node。所有架构连接器
(anyrouter/nekocode/sub2api/yescode) 和 HTTPClientPool 均适配
tunnel 模式,通过 TunnelTransport 替代传统代理。
This commit is contained in:
fawney19
2026-02-26 12:25:23 +08:00
parent 560345a889
commit 27cef96789
9 changed files with 101 additions and 51 deletions

View File

@@ -204,6 +204,13 @@ class HTTPClientPool:
if not proxy_config:
proxy_config = get_system_proxy_config()
# tunnel 模式检查tunnel 节点走专用的 TunnelTransport 客户端
from src.services.proxy_node.resolver import resolve_delegate_config
delegate_cfg = resolve_delegate_config(proxy_config)
if delegate_cfg and delegate_cfg.get("tunnel"):
return await cls._get_tunnel_client(delegate_cfg["node_id"])
cache_key = compute_proxy_cache_key(proxy_config)
# 无代理时返回默认客户端