mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-22 17:36:34 +03:00
Remove square braces from IPv6 addresses (#561)
This commit is contained in:
parent
43a3f40527
commit
3b8365f871
|
@ -56,12 +56,7 @@ class TcpClient:
|
|||
:param port: the port to connect to.
|
||||
"""
|
||||
if ':' in ip: # IPv6
|
||||
# The address needs to be surrounded by [] as discussed on PR#425
|
||||
if not ip.startswith('['):
|
||||
ip = '[' + ip
|
||||
if not ip.endswith(']'):
|
||||
ip = ip + ']'
|
||||
|
||||
ip = ip.replace('[', '').replace(']', '')
|
||||
mode, address = socket.AF_INET6, (ip, port, 0, 0)
|
||||
else:
|
||||
mode, address = socket.AF_INET, (ip, port)
|
||||
|
|
Loading…
Reference in New Issue
Block a user