Fix CDN DCs
This commit is contained in:
parent
cd1716645d
commit
553e4c4da0
2
schemas
2
schemas
|
@ -1 +1 @@
|
||||||
Subproject commit ef59cc0cb6723ebd600643faa50205065e8ee578
|
Subproject commit 03fe872f15fb8ccdcf074e885217aac1862aea12
|
|
@ -436,9 +436,9 @@ class DataCenter
|
||||||
/* @var $context \Amp\ConnectContext */
|
/* @var $context \Amp\ConnectContext */
|
||||||
$context = $context ?? (new ConnectContext())->withMaxAttempts(1)->withConnectTimeout(1000 * $this->settings[$dc_config_number]['timeout']);
|
$context = $context ?? (new ConnectContext())->withMaxAttempts(1)->withConnectTimeout(1000 * $this->settings[$dc_config_number]['timeout']);
|
||||||
foreach ($combos as $combo) {
|
foreach ($combos as $combo) {
|
||||||
$ipv6 = [$this->settings[$dc_config_number]['ipv6'] ? 'ipv6' : 'ipv4', $this->settings[$dc_config_number]['ipv6'] ? 'ipv4' : 'ipv6'];
|
foreach ([true, false] as $useDoH) {
|
||||||
foreach ($ipv6 as $ipv6) {
|
$ipv6Combos = [$this->settings[$dc_config_number]['ipv6'] ? 'ipv6' : 'ipv4', $this->settings[$dc_config_number]['ipv6'] ? 'ipv4' : 'ipv6'];
|
||||||
foreach ([true, false] as $useDoH) {
|
foreach ($ipv6Combos as $ipv6) {
|
||||||
// This is only for non-MTProto connections
|
// This is only for non-MTProto connections
|
||||||
if (!$dc_number) {
|
if (!$dc_number) {
|
||||||
/* @var $ctx \danog\MadelineProto\Stream\ConnectionContext */
|
/* @var $ctx \danog\MadelineProto\Stream\ConnectionContext */
|
||||||
|
@ -467,6 +467,9 @@ class DataCenter
|
||||||
foreach (\array_unique([$port, 443, 80, 88, 5222]) as $port) {
|
foreach (\array_unique([$port, 443, 80, 88, 5222]) as $port) {
|
||||||
$stream = \end($combo)[0];
|
$stream = \end($combo)[0];
|
||||||
if ($stream === HttpsStream::getName()) {
|
if ($stream === HttpsStream::getName()) {
|
||||||
|
if (\strpos($dc_number, '_cdn') !== false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$subdomain = $this->dclist['ssl_subdomains'][\preg_replace('/\\D+/', '', $dc_number)];
|
$subdomain = $this->dclist['ssl_subdomains'][\preg_replace('/\\D+/', '', $dc_number)];
|
||||||
if (\strpos($dc_number, '_media') !== false) {
|
if (\strpos($dc_number, '_media') !== false) {
|
||||||
$subdomain .= '-1';
|
$subdomain .= '-1';
|
||||||
|
@ -513,9 +516,6 @@ class DataCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($this->dclist[$test][$ipv6][$dc_number.'_bk']['ip_address'])) {
|
|
||||||
$ctxs = \array_merge($ctxs, $this->generateContexts($dc_number.'_bk'));
|
|
||||||
}
|
|
||||||
if (empty($ctxs)) {
|
if (empty($ctxs)) {
|
||||||
unset($this->sockets[$dc_number]);
|
unset($this->sockets[$dc_number]);
|
||||||
$this->API->logger->logger("No info for DC {$dc_number}", Logger::ERROR);
|
$this->API->logger->logger("No info for DC {$dc_number}", Logger::ERROR);
|
||||||
|
|
|
@ -1007,8 +1007,9 @@ class MTProto extends AsyncConstruct implements TLCallback
|
||||||
$this->startLoops();
|
$this->startLoops();
|
||||||
if (yield from $this->fullGetSelf()) {
|
if (yield from $this->fullGetSelf()) {
|
||||||
$this->authorized = self::LOGGED_IN;
|
$this->authorized = self::LOGGED_IN;
|
||||||
yield from $this->getCdnConfig($this->datacenter->curdc);
|
|
||||||
$this->setupLogger();
|
$this->setupLogger();
|
||||||
|
yield from $this->getCdnConfig($this->datacenter->curdc);
|
||||||
|
yield from $this->initAuthorization();
|
||||||
}
|
}
|
||||||
$this->startUpdateSystem(true);
|
$this->startUpdateSystem(true);
|
||||||
if ($this->authorized === self::LOGGED_IN && !$this->authorization['user']['bot'] && $this->settings['peer']['cache_all_peers_on_startup']) {
|
if ($this->authorized === self::LOGGED_IN && !$this->authorization['user']['bot'] && $this->settings['peer']['cache_all_peers_on_startup']) {
|
||||||
|
@ -1164,7 +1165,7 @@ class MTProto extends AsyncConstruct implements TLCallback
|
||||||
$lang_pack = 'android';
|
$lang_pack = 'android';
|
||||||
}
|
}
|
||||||
// Detect app version
|
// Detect app version
|
||||||
$app_version = self::RELEASE.' ('.self::V.', '.Magic::$revision.')';
|
$app_version = self::RELEASE.' ('.self::V.', '.str_replace(' (AN UPDATE IS REQUIRED)', '', Magic::$revision).')';
|
||||||
if (($settings['app_info']['api_id'] ?? 0) === 6) {
|
if (($settings['app_info']['api_id'] ?? 0) === 6) {
|
||||||
// TG DEV NOTICE: these app info spoofing measures were implemented for NON-MALICIOUS purposes.
|
// TG DEV NOTICE: these app info spoofing measures were implemented for NON-MALICIOUS purposes.
|
||||||
// All accounts registered with a custom API ID require manual verification through recover@telegram.org, to avoid instant permabans.
|
// All accounts registered with a custom API ID require manual verification through recover@telegram.org, to avoid instant permabans.
|
||||||
|
@ -1490,7 +1491,7 @@ class MTProto extends AsyncConstruct implements TLCallback
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
foreach ($this->datacenter->getDataCenterConnections() as $dc) {
|
foreach ($this->datacenter->getDataCenterConnections() as $dc) {
|
||||||
if (!$dc->isAuthorized() || !$dc->hasTempAuthKey()) {
|
if ((!$dc->isAuthorized() || !$dc->hasTempAuthKey()) && !$dc->isCDN()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,6 +102,10 @@ trait AuthKeyHandler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isset($key)) {
|
if (!isset($key)) {
|
||||||
|
if ($cdn) {
|
||||||
|
$this->logger->logger("Could not find required CDN public key, postponing CDN handshake...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
throw new \danog\MadelineProto\SecurityException("Couldn't find any of our keys in the server_public_key_fingerprints vector.");
|
throw new \danog\MadelineProto\SecurityException("Couldn't find any of our keys in the server_public_key_fingerprints vector.");
|
||||||
}
|
}
|
||||||
$pq_bytes = $ResPQ['pq'];
|
$pq_bytes = $ResPQ['pq'];
|
||||||
|
|
Loading…
Reference in New Issue