|
|
@@ -1,4 +1,5 @@
|
|
|
<?php
|
|
|
+
|
|
|
/**
|
|
|
* This file is part of workerman.
|
|
|
*
|
|
|
@@ -78,7 +79,7 @@ $gateway->onConnect = function ($connection) {
|
|
|
$apiToken = md5(strtolower('Customer-Service' . $_SERVER['HTTP_ORIGIN']));
|
|
|
//echo $apiToken."/".$_GET['apiToken'];
|
|
|
$_SESSION['userAgent'] = $_SERVER['HTTP_USER_AGENT'];
|
|
|
- $_SESSION['origin'] = $_SERVER['HTTP_ORIGIN'];//
|
|
|
+ $_SESSION['origin'] = $_SERVER['HTTP_ORIGIN']; //
|
|
|
$getToken = isset($_GET['apiToken']) ? $_GET['apiToken'] : '';
|
|
|
|
|
|
if ($getToken !== $apiToken) {
|
|
|
@@ -86,9 +87,11 @@ $gateway->onConnect = function ($connection) {
|
|
|
$connection->close();
|
|
|
return;
|
|
|
}
|
|
|
+ print_r($_SERVER['HTTP_X_REAL_IP']);
|
|
|
$_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['REMOTE_ADDR'] = $_SESSION['remotip'];
|
|
|
+ print_r(['rip' => $_SESSION['remotip'], 'sip' => $_SERVER['HTTP_X_REAL_IP']]);
|
|
|
|
|
|
|
|
|
// 可以在这里判断连接来源是否合法,不合法就关掉连接
|
|
|
@@ -106,4 +109,3 @@ $gateway->onConnect = function ($connection) {
|
|
|
if (!defined('GLOBAL_START')) {
|
|
|
Worker::runAll();
|
|
|
}
|
|
|
-
|