mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-01-25 00:34:19 +03:00
Fix protocol typing for python-socks.
This commit is contained in:
parent
633986cfa6
commit
38d8a54cc1
|
@ -74,11 +74,11 @@ class Connection(abc.ABC):
|
|||
# to be backwards compatible with PySocks proxy format,
|
||||
# (since socks.SOCKS5 == 2, socks.SOCKS4 == 1, socks.HTTP == 3)
|
||||
|
||||
if proxy_type == 2 or proxy_type == "socks5":
|
||||
if isinstance(proxy_type, ProxyType.SOCKS5) or proxy_type == 2 or proxy_type == "socks5":
|
||||
protocol = ProxyType.SOCKS5
|
||||
elif proxy_type == 1 or proxy_type == "socks4":
|
||||
elif isinstance(proxy_type, ProxyType.SOCKS4) or proxy_type == 1 or proxy_type == "socks4":
|
||||
protocol = ProxyType.SOCKS4
|
||||
elif proxy_type == 3 or proxy_type == "http":
|
||||
elif isinstance(proxy_type, ProxyType.HTTP) or proxy_type == 3 or proxy_type == "http":
|
||||
protocol = ProxyType.HTTP
|
||||
else:
|
||||
raise ValueError("Unknown proxy protocol type: {}".format(proxy_type))
|
||||
|
|
Loading…
Reference in New Issue
Block a user