mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-18 19:16:43 +00: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.
|
:param port: the port to connect to.
|
||||||
"""
|
"""
|
||||||
if ':' in ip: # IPv6
|
if ':' in ip: # IPv6
|
||||||
# The address needs to be surrounded by [] as discussed on PR#425
|
ip = ip.replace('[', '').replace(']', '')
|
||||||
if not ip.startswith('['):
|
|
||||||
ip = '[' + ip
|
|
||||||
if not ip.endswith(']'):
|
|
||||||
ip = ip + ']'
|
|
||||||
|
|
||||||
mode, address = socket.AF_INET6, (ip, port, 0, 0)
|
mode, address = socket.AF_INET6, (ip, port, 0, 0)
|
||||||
else:
|
else:
|
||||||
mode, address = socket.AF_INET, (ip, port)
|
mode, address = socket.AF_INET, (ip, port)
|
||||||
|
Loading…
Reference in New Issue
Block a user