fix(checks): update regex for proxy string to support socks proxy (#6236)

This commit is contained in:
秋澪Akimio
2026-08-06 15:08:29 +08:00
committed by GitHub
parent 4abae809c2
commit 57220c93db
+2 -2
View File
@@ -430,13 +430,13 @@ def _check_config(runner: DoctorRunnerProtocol) -> None:
) )
proxy_host = (settings.PROXY_HOST or "").strip() proxy_host = (settings.PROXY_HOST or "").strip()
if proxy_host and not re.match(r"^https?://", proxy_host, re.IGNORECASE): if proxy_host and not re.match(r"^(https?|socks5h?)://", proxy_host, re.IGNORECASE):
runner.add( runner.add(
finding_id="config.proxy_format", finding_id="config.proxy_format",
severity=DoctorSeverity.Warn, severity=DoctorSeverity.Warn,
status=DoctorFindingStatus.Degraded, status=DoctorFindingStatus.Degraded,
title="代理地址格式可能不完整", title="代理地址格式可能不完整",
detail=f"PROXY_HOST={proxy_host} 未包含 http:// 或 https:// 前缀。", detail=f"PROXY_HOST={proxy_host} 未包含 http:// 或 https:// 或 socks5:// 或 socks5h:// 前缀。",
recommendation="如果外部访问异常,请把 PROXY_HOST 调整为完整 URL。", recommendation="如果外部访问异常,请把 PROXY_HOST 调整为完整 URL。",
) )