Skip to content

Commit 8ac48c5

Browse files
committed
Add ipv6 data center addresses
1 parent 244b4f1 commit 8ac48c5

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

pyrogram/session/internals/data_center.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,24 @@ class DataCenter:
3434
121: "95.213.217.195"
3535
}
3636

37-
def __new__(cls, dc_id: int, test_mode: bool):
38-
return (cls.TEST[dc_id], 80) if test_mode else (cls.PROD[dc_id], 443)
37+
TEST_IPV6 = {
38+
1: "2001:0b28:f23d:f001:0000:0000:0000:000e",
39+
2: "2001:067c:04e8:f002:0000:0000:0000:000e",
40+
3: "2001:0b28:f23d:f003:0000:0000:0000:000e",
41+
121: "2a03:b0c0:0003:00d0:0000:0000:0114:d001"
42+
}
43+
44+
PROD_IPV6 = {
45+
1: "2001:0b28:f23d:f001:0000:0000:0000:000a",
46+
2: "2001:067c:04e8:f002:0000:0000:0000:000a",
47+
3: "2001:0b28:f23d:f003:0000:0000:0000:000a",
48+
4: "2001:067c:04e8:f004:0000:0000:0000:000a",
49+
5: "2001:0b28:f23f:f005:0000:0000:0000:000a",
50+
121: "2a03:b0c0:0003:00d0:0000:0000:0114:d001"
51+
}
52+
53+
def __new__(cls, dc_id: int, test_mode: bool, ipv6: bool):
54+
if ipv6:
55+
return (cls.TEST_IPV6[dc_id], 80) if test_mode else (cls.PROD_IPV6[dc_id], 443)
56+
else:
57+
return (cls.TEST[dc_id], 80) if test_mode else (cls.PROD[dc_id], 443)

0 commit comments

Comments
 (0)