Skip to content

Commit 56748ff

Browse files
committed
Make the underlying TCP protocol accept ipv6 addresses
1 parent efe26bc commit 56748ff

File tree

6 files changed

+16
-12
lines changed

6 files changed

+16
-12
lines changed

pyrogram/connection/transport/tcp/tcp.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@
3333

3434

3535
class TCP(socks.socksocket):
36-
def __init__(self, proxy: dict):
37-
super().__init__()
36+
def __init__(self, ipv6: bool, proxy: dict):
37+
super().__init__(family=socket.AF_INET6 if ipv6 else socket.AF_INET)
38+
3839
self.settimeout(10)
3940
self.proxy_enabled = proxy.get("enabled", False)
4041

pyrogram/connection/transport/tcp/tcp_abridged.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424

2525

2626
class TCPAbridged(TCP):
27-
def __init__(self, proxy: dict):
28-
super().__init__(proxy)
27+
def __init__(self, ipv6: bool, proxy: dict):
28+
super().__init__(ipv6, proxy)
2929

3030
def connect(self, address: tuple):
3131
super().connect(address)

pyrogram/connection/transport/tcp/tcp_abridged_o.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
class TCPAbridgedO(TCP):
2929
RESERVED = (b"HEAD", b"POST", b"GET ", b"OPTI", b"\xee" * 4)
3030

31-
def __init__(self, proxy: dict):
32-
super().__init__(proxy)
31+
def __init__(self, ipv6: bool, proxy: dict):
32+
super().__init__(ipv6, proxy)
33+
3334
self.encrypt = None
3435
self.decrypt = None
3536

pyrogram/connection/transport/tcp/tcp_full.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626

2727

2828
class TCPFull(TCP):
29-
def __init__(self, proxy: dict):
30-
super().__init__(proxy)
29+
def __init__(self, ipv6: bool, proxy: dict):
30+
super().__init__(ipv6, proxy)
31+
3132
self.seq_no = None
3233

3334
def connect(self, address: tuple):

pyrogram/connection/transport/tcp/tcp_intermediate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525

2626

2727
class TCPIntermediate(TCP):
28-
def __init__(self, proxy: dict):
29-
super().__init__(proxy)
28+
def __init__(self, ipv6: bool, proxy: dict):
29+
super().__init__(ipv6, proxy)
3030

3131
def connect(self, address: tuple):
3232
super().connect(address)

pyrogram/connection/transport/tcp/tcp_intermediate_o.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@
2929
class TCPIntermediateO(TCP):
3030
RESERVED = (b"HEAD", b"POST", b"GET ", b"OPTI", b"\xee" * 4)
3131

32-
def __init__(self, proxy: dict):
33-
super().__init__(proxy)
32+
def __init__(self, ipv6: bool, proxy: dict):
33+
super().__init__(ipv6, proxy)
34+
3435
self.encrypt = None
3536
self.decrypt = None
3637

0 commit comments

Comments
 (0)