try again

This commit is contained in:
Roy Olav Purser 2021-06-04 11:02:19 +02:00
parent 9c5297b316
commit ba1f9a06b0
Signed by: roypur
GPG Key ID: E14D26A036F21656

View File

@ -101,10 +101,10 @@ class UpstreamHandler():
self.proxy = ProxyElem(None) self.proxy = ProxyElem(None)
self.upstream = None self.upstream = None
async def test_socks(self, proxy): async def test_socks(self, proxy):
if not isinstance(proxy, str): if not hasattr(proxy, "proxy") or not isinstance(proxy.proxy, str):
return (True, ProxyElem(None)) return (True, ProxyElem(None))
try: try:
splitted = proxy.rsplit(":", 1) splitted = proxy.proxy.rsplit(":", 1)
host = proxy host = proxy
port = 1080 port = 1080
if len(splitted) == 2: if len(splitted) == 2:
@ -130,7 +130,7 @@ class UpstreamHandler():
if isinstance(proxy_list, list): if isinstance(proxy_list, list):
futures = [] futures = []
for current in proxy_list: for current in proxy_list:
future = asyncio.create_task(self.test_socks(current.proxy)) future = asyncio.create_task(self.test_socks(current))
futures.append(future) futures.append(future)
for future in asyncio.as_completed(futures): for future in asyncio.as_completed(futures):
success, current = await future success, current = await future