首次上传

This commit is contained in:
dekun
2026-05-16 22:25:48 +08:00
commit 2b8f902548
88 changed files with 16386 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
"""代理 URL 与 httpx 的兼容处理。"""
def httpx_proxy_url(proxy_url: str | None) -> str | None:
"""
将配置中的代理地址转为 httpx 可用的形式。
部分环境(socksio / httpx)不支持 ``socks5h://`` scheme,会报
``Unknown scheme for proxy URL``;此时退化为 ``socks5://``(域名在本机解析后再走 SOCKS)。
"""
if not proxy_url or not str(proxy_url).strip():
return None
u = str(proxy_url).strip()
if u.startswith("socks5h://"):
return "socks5://" + u[len("socks5h://") :]
return u