Allow session to use ipv6

This commit is contained in:
Dan 2018-06-13 13:37:35 +02:00
parent c9469ed542
commit b804709c6c

View File

@ -35,7 +35,7 @@ from pyrogram.api.core import Message, Object, MsgContainer, Long, FutureSalt, I
from pyrogram.api.errors import Error, InternalServerError from pyrogram.api.errors import Error, InternalServerError
from pyrogram.connection import Connection from pyrogram.connection import Connection
from pyrogram.crypto import AES, KDF from pyrogram.crypto import AES, KDF
from .internals import MsgId, MsgFactory, DataCenter from .internals import MsgId, MsgFactory
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -86,6 +86,7 @@ class Session:
def __init__(self, def __init__(self,
dc_id: int, dc_id: int,
test_mode: bool, test_mode: bool,
ipv6: bool,
proxy: dict, proxy: dict,
auth_key: bytes, auth_key: bytes,
api_id: int, api_id: int,
@ -98,6 +99,7 @@ class Session:
self.dc_id = dc_id self.dc_id = dc_id
self.test_mode = test_mode self.test_mode = test_mode
self.ipv6 = ipv6
self.proxy = proxy self.proxy = proxy
self.api_id = api_id self.api_id = api_id
self.is_cdn = is_cdn self.is_cdn = is_cdn
@ -130,7 +132,7 @@ class Session:
def start(self): def start(self):
while True: while True:
self.connection = Connection(DataCenter(self.dc_id, self.test_mode), self.proxy) self.connection = Connection(self.dc_id, self.test_mode, self.ipv6, self.proxy)
try: try:
self.connection.connect() self.connection.connect()