mirror of
https://github.com/v2board/v2board.git
synced 2025-01-11 00:29:09 +08:00
update: add random port
This commit is contained in:
parent
c8c96365ea
commit
a1ada9183c
@ -8,6 +8,7 @@ use App\Models\User;
|
|||||||
use App\Models\ServerV2ray;
|
use App\Models\ServerV2ray;
|
||||||
use App\Models\ServerTrojan;
|
use App\Models\ServerTrojan;
|
||||||
use App\Utils\CacheKey;
|
use App\Utils\CacheKey;
|
||||||
|
use App\Utils\Helper;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
|
||||||
class ServerService
|
class ServerService
|
||||||
@ -34,6 +35,9 @@ class ServerService
|
|||||||
}
|
}
|
||||||
array_push($servers, $v2ray[$i]->toArray());
|
array_push($servers, $v2ray[$i]->toArray());
|
||||||
}
|
}
|
||||||
|
if (strpos($v2ray[$i]['port'], '-') !== false) {
|
||||||
|
$v2ray[$i]['port'] = Helper::randomPort($v2ray[$i]['port']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -59,6 +63,9 @@ class ServerService
|
|||||||
}
|
}
|
||||||
array_push($servers, $trojan[$i]->toArray());
|
array_push($servers, $trojan[$i]->toArray());
|
||||||
}
|
}
|
||||||
|
if (strpos($trojan[$i]['port'], '-') !== false) {
|
||||||
|
$trojan[$i]['port'] = Helper::randomPort($trojan[$i]['port']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $servers;
|
return $servers;
|
||||||
}
|
}
|
||||||
@ -82,7 +89,9 @@ class ServerService
|
|||||||
}
|
}
|
||||||
array_push($servers, $shadowsocks[$i]->toArray());
|
array_push($servers, $shadowsocks[$i]->toArray());
|
||||||
}
|
}
|
||||||
|
if (strpos($shadowsocks[$i]['port'], '-') !== false) {
|
||||||
|
$shadowsocks[$i]['port'] = Helper::randomPort($shadowsocks[$i]['port']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $servers;
|
return $servers;
|
||||||
}
|
}
|
||||||
|
@ -112,4 +112,9 @@ class Helper
|
|||||||
}
|
}
|
||||||
return $subscribeUrl;
|
return $subscribeUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function randomPort($range) {
|
||||||
|
$portRange = explode('-', $range);
|
||||||
|
return rand($portRange[0], $portRange[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user