Adds VPN-aware leak handling, chain testing UX improvements, hardened Firefox launch/profile management, privacy/device hardening modules, and tray/status upgrades so the app is production-ready as the new baseline. Co-authored-by: Cursor <cursoragent@cursor.com>
42 lines
1.0 KiB
Python
42 lines
1.0 KiB
Python
"""Fast parallel proxy checks for the GUI (per-hop callbacks)."""
|
|
from __future__ import annotations
|
|
|
|
import asyncio
|
|
from typing import Callable
|
|
|
|
from .validator import _check_one
|
|
|
|
# High concurrency for interactive chain tests
|
|
GUI_VALIDATE_CONCURRENCY = 48
|
|
|
|
|
|
async def validate_each_parallel(
|
|
urls: list[str],
|
|
check_url: str,
|
|
concurrency: int,
|
|
timeout_seconds: float,
|
|
on_result: Callable[[str, bool], None],
|
|
) -> None:
|
|
if not urls:
|
|
return
|
|
sem = asyncio.Semaphore(max(1, concurrency))
|
|
|
|
async def one(u: str) -> None:
|
|
async with sem:
|
|
ok = await _check_one(u, check_url, timeout_seconds)
|
|
on_result(u, ok)
|
|
|
|
await asyncio.gather(*(one(u) for u in urls))
|
|
|
|
|
|
def run_validate_each_sync(
|
|
urls: list[str],
|
|
check_url: str,
|
|
timeout_seconds: float,
|
|
on_result: Callable[[str, bool], None],
|
|
concurrency: int = GUI_VALIDATE_CONCURRENCY,
|
|
) -> None:
|
|
asyncio.run(
|
|
validate_each_parallel(urls, check_url, concurrency, timeout_seconds, on_result)
|
|
)
|