Improve exit IP failure diagnostics
This commit is contained in:
@@ -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")
|
errors.append(f"{host}: no ip in response")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
errors.append(f"{host}: {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
|
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)
|
await socks5_connect(proxy, timeout)
|
||||||
latency = int((time.perf_counter() - start) * 1000)
|
latency = int((time.perf_counter() - start) * 1000)
|
||||||
exit_ip = await get_exit_ip_via_socks(proxy, timeout)
|
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
|
return True, latency, err, exit_ip
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return False, int((time.perf_counter() - start) * 1000), str(e), None
|
return False, int((time.perf_counter() - start) * 1000), str(e), None
|
||||||
|
|||||||
Reference in New Issue
Block a user