Improve exit IP failure diagnostics

This commit is contained in:
2026-05-28 22:11:18 +08:00
parent dd7cc18c88
commit 680cb34000
+2 -2
View File
@@ -436,7 +436,7 @@ async def get_exit_ip_via_socks(proxy: dict[str, Any], timeout: float) -> str |
errors.append(f"{host}: no ip in response")
except Exception as e:
errors.append(f"{host}: {e}")
proxy["last_exit_ip_error"] = "; ".join(errors[-3:])
proxy["last_exit_ip_error"] = "; ".join(errors[-3:]) or "exit ip lookup failed: empty response from all providers"
return None
@@ -447,7 +447,7 @@ async def check_proxy(proxy: dict[str, Any]) -> tuple[bool, int | None, str | No
await socks5_connect(proxy, timeout)
latency = int((time.perf_counter() - start) * 1000)
exit_ip = await get_exit_ip_via_socks(proxy, timeout)
err = None if exit_ip else proxy.get("last_exit_ip_error")
err = None if exit_ip else (proxy.get("last_exit_ip_error") or "exit ip lookup failed")
return True, latency, err, exit_ip
except Exception as e:
return False, int((time.perf_counter() - start) * 1000), str(e), None