INNER CODE UNIT · Python

_check_tor_connectivity

KatrielMoses/voidaccess · api/main.py:567

def _check_tor_connectivity() -> bool:
    """Return True if Tor proxy appears to be reachable. Sync wrapper for startup."""
    import socket  # noqa: PLC0415
    host = os.getenv("TOR_PROXY_HOST", "127.0.0.1")
    port = int(os.getenv("TOR_PROXY_PORT", "9050"))
    try:
        with socket.create_connection((host, port), timeout=2):
            return True
    except OSError:
        return False


# ---------------------------------------------------------------------------
# Health endpoints
# ---------------------------------------------------------------------------


@app.get("/health", tags=["health"])

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…