This commit is contained in:
parent
98924eb867
commit
96a6277a01
@ -40,7 +40,8 @@ class UpstreamHandler:
|
|||||||
port = splitted[1]
|
port = splitted[1]
|
||||||
future = asyncio.open_connection(host=host, port=port)
|
future = asyncio.open_connection(host=host, port=port)
|
||||||
await asyncio.wait_for(future, timeout=1)
|
await asyncio.wait_for(future, timeout=1)
|
||||||
except Exception:
|
except Exception as e:
|
||||||
|
logger.info(e)
|
||||||
return (False, proxy)
|
return (False, proxy)
|
||||||
else:
|
else:
|
||||||
return (True, proxy)
|
return (True, proxy)
|
||||||
@ -79,7 +80,6 @@ class UpstreamHandler:
|
|||||||
for future in asyncio.as_completed(futures):
|
for future in asyncio.as_completed(futures):
|
||||||
success, current = await future
|
success, current = await future
|
||||||
if success:
|
if success:
|
||||||
logger.info(current)
|
|
||||||
self.proxy = current
|
self.proxy = current
|
||||||
break
|
break
|
||||||
for future in futures:
|
for future in futures:
|
||||||
|
@ -122,8 +122,6 @@ class StreamProvider:
|
|||||||
self.upstream = upstream
|
self.upstream = upstream
|
||||||
self.proxy = None
|
self.proxy = None
|
||||||
self.logger = logger
|
self.logger = logger
|
||||||
self.logger.info("%s <%s>", proxy, upstream)
|
|
||||||
self.logger.info("%s <%s>", type(proxy), upstream)
|
|
||||||
|
|
||||||
if isinstance(proxy, config.ProxyElem):
|
if isinstance(proxy, config.ProxyElem):
|
||||||
self.proxy = proxy
|
self.proxy = proxy
|
||||||
@ -165,7 +163,6 @@ class StreamProvider:
|
|||||||
proxies = {}
|
proxies = {}
|
||||||
proxies["http"] = "socks5://" + self.proxy.proxy
|
proxies["http"] = "socks5://" + self.proxy.proxy
|
||||||
proxies["https"] = "socks5://" + self.proxy.proxy
|
proxies["https"] = "socks5://" + self.proxy.proxy
|
||||||
self.logger.info("%s <%s>", proxies, self.upstream)
|
|
||||||
|
|
||||||
ctype = None
|
ctype = None
|
||||||
upstream = data.upstream()
|
upstream = data.upstream()
|
||||||
|
Loading…
Reference in New Issue
Block a user