From de26dc37abb72501ed0783e895d8101ff0c83d20 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 4 Oct 2017 20:08:45 +0300 Subject: [PATCH] Proxy fixes --- src/danog/MadelineProto/Connection.php | 3 +-- src/danog/MadelineProto/MTProto.php | 2 +- tests/testing.php | 3 +++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/danog/MadelineProto/Connection.php b/src/danog/MadelineProto/Connection.php index 37bc6b7c..01a76595 100644 --- a/src/danog/MadelineProto/Connection.php +++ b/src/danog/MadelineProto/Connection.php @@ -73,8 +73,7 @@ class Connection $this->port = $port; $this->proxy = $proxy; $this->extra = $extra; - - if (($has_proxy = $proxy !== '\Socket') && !isset(class_implements($proxy)['\danog\MadelineProto\Proxy'])) { + if (($has_proxy = $proxy !== '\Socket') && !isset(class_implements($proxy)['danog\MadelineProto\Proxy'])) { throw new \danog\MadelineProto\Exception(\danog\MadelineProto\Lang::$current_lang['proxy_class_invalid']); } switch ($this->protocol) { diff --git a/src/danog/MadelineProto/MTProto.php b/src/danog/MadelineProto/MTProto.php index dfe7c11f..5e29b58a 100644 --- a/src/danog/MadelineProto/MTProto.php +++ b/src/danog/MadelineProto/MTProto.php @@ -607,7 +607,7 @@ class MTProto } if ($settings['app_info']['api_id'] < 20) { -// $settings['connection_settings']['all']['protocol'] = 'obfuscated2'; + $settings['connection_settings']['all']['protocol'] = 'obfuscated2'; } switch ($settings['logger']['logger_level']) { case 'ULTRA_VERBOSE': $settings['logger']['logger_level'] = 5; break; diff --git a/tests/testing.php b/tests/testing.php index a7f61aed..7538e9c7 100755 --- a/tests/testing.php +++ b/tests/testing.php @@ -14,6 +14,7 @@ set_include_path(get_include_path().':'.realpath(dirname(__FILE__).'/../').':'.r chdir(dirname(__FILE__).'/../'); require_once 'vendor/autoload.php'; + if (!function_exists('readline')) { function readline($prompt = null) { @@ -50,6 +51,8 @@ if (getenv('TEST_SECRET_CHAT') == '') { } echo 'Loading settings...'.PHP_EOL; $settings = json_decode(getenv('MTPROTO_SETTINGS'), true) ?: []; +//$settings['connection_settings']['all']['proxy'] = '\SocksProxy'; +//$settings['connection_settings']['all']['proxy_extra'] = ['address' => '190.83.240.10', 'port' => 20057]; var_dump($settings); if ($MadelineProto === false) {