INNER CODE UNIT · Python
test_single_proxy
tombcato/clash-ip-checker · clash_automator.py:26
async def test_single_proxy(controller: ClashController, checker: IPChecker, proxy_name: str, selector: str, local_proxy: str,
fast_mode: bool = FAST_MODE, source: str = SOURCE, fallback: bool = FALLBACK) -> Dict[str, Any]:
"""
Tests a single proxy: switches to it, waits, and checks IP.
Returns the result dictionary (or error dict).
"""
print(f"\nTesting: {proxy_name}")
# ... switch logic same ...
# 1. Switch Node
print(f" -> Switching {selector} ...")
switched = await controller.switch_proxy(selector, proxy_name)
if not switched:
print(" -> Switch failed, skipping IP check.")
return {"full_string": "【❌ Switch Error】", "ip": "Error", "pure_score": "?", "bot_score": "?"}
# 2. Wait for switch to take effect