mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 17:36:34 +03:00
Allow switching from IPv4 to IPv6 and vice versa
This commit is contained in:
parent
ee5915e86d
commit
edd73ed69a
|
@ -96,7 +96,9 @@ class TelegramBareClient:
|
||||||
'The given session must be a str or a Session instance.'
|
'The given session must be a str or a Session instance.'
|
||||||
)
|
)
|
||||||
|
|
||||||
if not session.server_address:
|
# ':' in session.server_address is True if it's an IPv6 address
|
||||||
|
if (not session.server_address or
|
||||||
|
(':' in session.server_address) != use_ipv6):
|
||||||
session.port = DEFAULT_PORT
|
session.port = DEFAULT_PORT
|
||||||
session.server_address = \
|
session.server_address = \
|
||||||
DEFAULT_IPV6_IP if self._use_ipv6 else DEFAULT_IPV4_IP
|
DEFAULT_IPV6_IP if self._use_ipv6 else DEFAULT_IPV4_IP
|
||||||
|
|
Loading…
Reference in New Issue
Block a user