diff --git a/pyrogram/connection/transport/tcp/tcp.py b/pyrogram/connection/transport/tcp/tcp.py index 5df8aacb..8560604f 100644 --- a/pyrogram/connection/transport/tcp/tcp.py +++ b/pyrogram/connection/transport/tcp/tcp.py @@ -33,8 +33,9 @@ log = logging.getLogger(__name__) class TCP(socks.socksocket): - def __init__(self, proxy: dict): - super().__init__() + def __init__(self, ipv6: bool, proxy: dict): + super().__init__(family=socket.AF_INET6 if ipv6 else socket.AF_INET) + self.settimeout(10) self.proxy_enabled = proxy.get("enabled", False) diff --git a/pyrogram/connection/transport/tcp/tcp_abridged.py b/pyrogram/connection/transport/tcp/tcp_abridged.py index 472f4799..d89421f5 100644 --- a/pyrogram/connection/transport/tcp/tcp_abridged.py +++ b/pyrogram/connection/transport/tcp/tcp_abridged.py @@ -24,8 +24,8 @@ log = logging.getLogger(__name__) class TCPAbridged(TCP): - def __init__(self, proxy: dict): - super().__init__(proxy) + def __init__(self, ipv6: bool, proxy: dict): + super().__init__(ipv6, proxy) def connect(self, address: tuple): super().connect(address) diff --git a/pyrogram/connection/transport/tcp/tcp_abridged_o.py b/pyrogram/connection/transport/tcp/tcp_abridged_o.py index bba88e34..57cc0336 100644 --- a/pyrogram/connection/transport/tcp/tcp_abridged_o.py +++ b/pyrogram/connection/transport/tcp/tcp_abridged_o.py @@ -28,8 +28,9 @@ log = logging.getLogger(__name__) class TCPAbridgedO(TCP): RESERVED = (b"HEAD", b"POST", b"GET ", b"OPTI", b"\xee" * 4) - def __init__(self, proxy: dict): - super().__init__(proxy) + def __init__(self, ipv6: bool, proxy: dict): + super().__init__(ipv6, proxy) + self.encrypt = None self.decrypt = None diff --git a/pyrogram/connection/transport/tcp/tcp_full.py b/pyrogram/connection/transport/tcp/tcp_full.py index 1b131678..0aac1a14 100644 --- a/pyrogram/connection/transport/tcp/tcp_full.py +++ b/pyrogram/connection/transport/tcp/tcp_full.py @@ -26,8 +26,9 @@ log = logging.getLogger(__name__) class TCPFull(TCP): - def __init__(self, proxy: dict): - super().__init__(proxy) + def __init__(self, ipv6: bool, proxy: dict): + super().__init__(ipv6, proxy) + self.seq_no = None def connect(self, address: tuple): diff --git a/pyrogram/connection/transport/tcp/tcp_intermediate.py b/pyrogram/connection/transport/tcp/tcp_intermediate.py index 4b2e2596..b33fe466 100644 --- a/pyrogram/connection/transport/tcp/tcp_intermediate.py +++ b/pyrogram/connection/transport/tcp/tcp_intermediate.py @@ -25,8 +25,8 @@ log = logging.getLogger(__name__) class TCPIntermediate(TCP): - def __init__(self, proxy: dict): - super().__init__(proxy) + def __init__(self, ipv6: bool, proxy: dict): + super().__init__(ipv6, proxy) def connect(self, address: tuple): super().connect(address) diff --git a/pyrogram/connection/transport/tcp/tcp_intermediate_o.py b/pyrogram/connection/transport/tcp/tcp_intermediate_o.py index df79352a..e8c96ebc 100644 --- a/pyrogram/connection/transport/tcp/tcp_intermediate_o.py +++ b/pyrogram/connection/transport/tcp/tcp_intermediate_o.py @@ -29,8 +29,9 @@ log = logging.getLogger(__name__) class TCPIntermediateO(TCP): RESERVED = (b"HEAD", b"POST", b"GET ", b"OPTI", b"\xee" * 4) - def __init__(self, proxy: dict): - super().__init__(proxy) + def __init__(self, ipv6: bool, proxy: dict): + super().__init__(ipv6, proxy) + self.encrypt = None self.decrypt = None