Skip to content

Commit efe26bc

Browse files
committed
Allow Connection to connect to ipv6 addresses
1 parent 8ac48c5 commit efe26bc

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pyrogram/connection/connection.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import time
2222

2323
from .transport import *
24+
from ..session.internals import DataCenter
2425

2526
log = logging.getLogger(__name__)
2627

@@ -36,16 +37,18 @@ class Connection:
3637
4: TCPIntermediateO
3738
}
3839

39-
def __init__(self, address: tuple, proxy: dict, mode: int = 1):
40-
self.address = address
40+
def __init__(self, dc_id: int, test_mode: bool, ipv6: bool, proxy: dict, mode: int = 1):
41+
self.ipv6 = ipv6
4142
self.proxy = proxy
43+
self.address = DataCenter(dc_id, test_mode, ipv6)
4244
self.mode = self.MODES.get(mode, TCPAbridged)
45+
4346
self.lock = threading.Lock()
4447
self.connection = None
4548

4649
def connect(self):
4750
for i in range(Connection.MAX_RETRIES):
48-
self.connection = self.mode(self.proxy)
51+
self.connection = self.mode(self.ipv6, self.proxy)
4952

5053
try:
5154
log.info("Connecting...")

0 commit comments

Comments
 (0)