xiang 6 yıl önce
ebeveyn
işleme
96ea017e70

+ 1 - 10
vendor/GatewayWorker_linux/GatewayWorker/Applications/whisper/start_gateway.php

@@ -87,18 +87,11 @@ $gateway->onConnect = function ($connection) {
             $connection->close();
             return;
         }
-
-        $_SESSION['remotip'] = isset($_SERVER['HTTP_X_REAL_IP'])  ? $_SERVER['HTTP_X_REAL_IP'] : $connection->getRemoteIp();
-        // //从cdn中提取ip
-        // $ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
-        // if (isset($ips[0])  && $ips[0]) { } else {
-        //     $_SESSION['remotip'] = $ips[0];
-        // }
+        $_SESSION['remotip'] = isset($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['HTTP_X_REAL_IP'] : $connection->getRemoteIp();
         $_SESSION['remotport'] = $connection->getRemotePort();
         $_SERVER['REMOTE_ADDR'] = $_SESSION['remotip'];
 
 
-
         // 可以在这里判断连接来源是否合法,不合法就关掉连接
         // $_SERVER['HTTP_ORIGIN']标识来自哪个站点的页面发起的websocket链接
         /*if($_SERVER['HTTP_ORIGIN'] != 'http://kedou.workerman.net')
@@ -110,8 +103,6 @@ $gateway->onConnect = function ($connection) {
     };
 };
 
-
-
 // 如果不是在根目录启动,则运行runAll方法
 if (!defined('GLOBAL_START')) {
     Worker::runAll();