Early-exit validation: stop once enough valid proxies found

- validate_proxies: target= param — once N valid found, remaining
  tasks skip the HTTP call and drain immediately (no wasted time)
- _build_pool: target = max(min_pool_size, chain_length * 3)
- Settings: min_pool_size (default 20), max_candidates default 400->200
- UI: Stop after N valid / Max candidates fields in Settings tab
- README: updated settings table
- 1 new test for early-exit with unreachable target

Made-with: Cursor
This commit is contained in:
Dr Jones
2026-04-16 02:31:40 -07:00
parent 8ffde94d48
commit 9439037cac
6 changed files with 66 additions and 9 deletions

View File

@@ -129,6 +129,20 @@ class TestValidator(unittest.TestCase):
self.assertEqual(asyncio.run(run()), [])
def test_validate_early_exit_target(self) -> None:
"""Once target is reached remaining tasks should be skipped (all dead here → no early exit but no crash)."""
async def run() -> list[str]:
return await validate_proxies(
["http://127.0.0.1:1"] * 10,
"https://api.ipify.org?format=json",
4,
2.0,
target=2, # target unreachable — should still return [] cleanly
)
result = asyncio.run(run())
self.assertEqual(result, [])
def test_get_direct_ip_network(self) -> None:
async def run() -> str | None:
return await get_direct_ip("https://api.ipify.org?format=json", 12.0)