mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-17 21:22:40 +00:00
Allow Connection to connect to ipv6 addresses
This commit is contained in:
parent
8ac48c555c
commit
efe26bcb19
@ -21,6 +21,7 @@ import threading
|
||||
import time
|
||||
|
||||
from .transport import *
|
||||
from ..session.internals import DataCenter
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -36,16 +37,18 @@ class Connection:
|
||||
4: TCPIntermediateO
|
||||
}
|
||||
|
||||
def __init__(self, address: tuple, proxy: dict, mode: int = 1):
|
||||
self.address = address
|
||||
def __init__(self, dc_id: int, test_mode: bool, ipv6: bool, proxy: dict, mode: int = 1):
|
||||
self.ipv6 = ipv6
|
||||
self.proxy = proxy
|
||||
self.address = DataCenter(dc_id, test_mode, ipv6)
|
||||
self.mode = self.MODES.get(mode, TCPAbridged)
|
||||
|
||||
self.lock = threading.Lock()
|
||||
self.connection = None
|
||||
|
||||
def connect(self):
|
||||
for i in range(Connection.MAX_RETRIES):
|
||||
self.connection = self.mode(self.proxy)
|
||||
self.connection = self.mode(self.ipv6, self.proxy)
|
||||
|
||||
try:
|
||||
log.info("Connecting...")
|
||||
|
Loading…
Reference in New Issue
Block a user