Support multiple Test DC connections

This commit is contained in:
Wizou 2022-09-11 15:34:38 +02:00
parent 26942d33f2
commit b1649839d9
2 changed files with 3 additions and 0 deletions

View file

@ -100,6 +100,7 @@ namespace WTelegram
TcpHandler = cloneOf.TcpHandler;
MTProxyUrl = cloneOf.MTProxyUrl;
PingInterval = cloneOf.PingInterval;
TLConfig = cloneOf.TLConfig;
_dcSession = dcSession;
}
@ -706,6 +707,7 @@ namespace WTelegram
if (MTProxyUrl != null)
{
#if OBFUSCATION
if (TLConfig?.test_mode == true) dcId += 10000;
if (_dcSession.DataCenter?.flags.HasFlag(DcOption.Flags.media_only) == true) dcId = -dcId;
var parms = HttpUtility.ParseQueryString(MTProxyUrl[MTProxyUrl.IndexOf('?')..]);
var server = parms["server"];

View file

@ -56,6 +56,7 @@ namespace WTelegram
new_nonce = new Int256(RNG),
dc = session.DataCenter?.id ?? 0
};
if (client.TLConfig?.test_mode == true) pqInnerData.dc += 10000;
if (session.DataCenter?.flags.HasFlag(DcOption.Flags.media_only) == true) pqInnerData.dc = -pqInnerData.dc;
byte[] encrypted_data = null;
{