mirror of
https://github.com/v2board/v2board.git
synced 2025-02-24 22:30:29 +08:00
opt 1.2.3
This commit is contained in:
parent
ba9ec7006b
commit
6a6de2dc22
@ -2,6 +2,9 @@
|
||||
|
||||
namespace App\Utils;
|
||||
|
||||
use App\Models\Server;
|
||||
use App\Models\User;
|
||||
|
||||
class Helper
|
||||
{
|
||||
public static function guid($format = false)
|
||||
@ -53,23 +56,23 @@ class Helper
|
||||
return $str;
|
||||
}
|
||||
|
||||
public static function buildVmessLink($item, $user)
|
||||
public static function buildVmessLink(Server $server, User $user)
|
||||
{
|
||||
$config = [
|
||||
"v" => "2",
|
||||
"ps" => $item->name,
|
||||
"add" => $item->host,
|
||||
"port" => $item->port,
|
||||
"ps" => $server->name,
|
||||
"add" => $server->host,
|
||||
"port" => $server->port,
|
||||
"id" => $user->v2ray_uuid,
|
||||
"aid" => "2",
|
||||
"net" => $item->network,
|
||||
"net" => $server->network,
|
||||
"type" => "none",
|
||||
"host" => "",
|
||||
"path" => "",
|
||||
"tls" => $item->tls ? "tls" : ""
|
||||
"tls" => $server->tls ? "tls" : ""
|
||||
];
|
||||
if ($item->network == 'ws') {
|
||||
$wsSettings = json_decode($item->settings);
|
||||
if ((string)$server->network === 'ws') {
|
||||
$wsSettings = json_decode($server->networkSettings);
|
||||
if (isset($wsSettings->path)) $config['path'] = $wsSettings->path;
|
||||
if (isset($wsSettings->headers->Host)) $config['host'] = $wsSettings->headers->Host;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user