mirror of
https://github.com/alexbers/mtprotoproxy.git
synced 2026-03-21 18:15:50 +00:00
Merge pull request #11 from Forst/master
Add support for IPv6 middle proxies
This commit is contained in:
@@ -75,6 +75,14 @@ TG_MIDDLE_PROXIES_V4 = [
|
|||||||
("91.108.4.136", 8888), ("91.108.56.181", 8888)
|
("91.108.4.136", 8888), ("91.108.56.181", 8888)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
TG_MIDDLE_PROXIES_V6 = [
|
||||||
|
("2001:0b28:f23d:f001:0000:0000:0000:000d", 8888),
|
||||||
|
("2001:067c:04e8:f002:0000:0000:0000:000d", 80),
|
||||||
|
("2001:0b28:f23d:f003:0000:0000:0000:000d", 8888),
|
||||||
|
("2001:067c:04e8:f004:0000:0000:0000:000d", 8888),
|
||||||
|
("2001:0b28:f23f:f005:0000:0000:0000:000d", 8888)
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
USE_MIDDLE_PROXY = (len(AD_TAG) == 16)
|
USE_MIDDLE_PROXY = (len(AD_TAG) == 16)
|
||||||
|
|
||||||
@@ -468,9 +476,14 @@ async def do_middleproxy_handshake(dc_idx):
|
|||||||
SENDER_PID = b"IPIPPRPDTIME"
|
SENDER_PID = b"IPIPPRPDTIME"
|
||||||
PEER_PID = b"IPIPPRPDTIME"
|
PEER_PID = b"IPIPPRPDTIME"
|
||||||
|
|
||||||
if not 0 <= dc_idx < len(TG_MIDDLE_PROXIES_V4):
|
if PREFER_IPV6:
|
||||||
return False
|
if not 0 <= dc_idx < len(TG_MIDDLE_PROXIES_V6):
|
||||||
addr, port = TG_MIDDLE_PROXIES_V4[dc_idx]
|
return False
|
||||||
|
addr, port = TG_MIDDLE_PROXIES_V6[dc_idx]
|
||||||
|
else:
|
||||||
|
if not 0 <= dc_idx < len(TG_MIDDLE_PROXIES_V4):
|
||||||
|
return False
|
||||||
|
addr, port = TG_MIDDLE_PROXIES_V4[dc_idx]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
reader_tgt, writer_tgt = await asyncio.open_connection(addr, port)
|
reader_tgt, writer_tgt = await asyncio.open_connection(addr, port)
|
||||||
|
|||||||
Reference in New Issue
Block a user