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;
|
namespace App\Utils;
|
||||||
|
|
||||||
|
use App\Models\Server;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
class Helper
|
class Helper
|
||||||
{
|
{
|
||||||
public static function guid($format = false)
|
public static function guid($format = false)
|
||||||
@ -53,23 +56,23 @@ class Helper
|
|||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function buildVmessLink($item, $user)
|
public static function buildVmessLink(Server $server, User $user)
|
||||||
{
|
{
|
||||||
$config = [
|
$config = [
|
||||||
"v" => "2",
|
"v" => "2",
|
||||||
"ps" => $item->name,
|
"ps" => $server->name,
|
||||||
"add" => $item->host,
|
"add" => $server->host,
|
||||||
"port" => $item->port,
|
"port" => $server->port,
|
||||||
"id" => $user->v2ray_uuid,
|
"id" => $user->v2ray_uuid,
|
||||||
"aid" => "2",
|
"aid" => "2",
|
||||||
"net" => $item->network,
|
"net" => $server->network,
|
||||||
"type" => "none",
|
"type" => "none",
|
||||||
"host" => "",
|
"host" => "",
|
||||||
"path" => "",
|
"path" => "",
|
||||||
"tls" => $item->tls ? "tls" : ""
|
"tls" => $server->tls ? "tls" : ""
|
||||||
];
|
];
|
||||||
if ($item->network == 'ws') {
|
if ((string)$server->network === 'ws') {
|
||||||
$wsSettings = json_decode($item->settings);
|
$wsSettings = json_decode($server->networkSettings);
|
||||||
if (isset($wsSettings->path)) $config['path'] = $wsSettings->path;
|
if (isset($wsSettings->path)) $config['path'] = $wsSettings->path;
|
||||||
if (isset($wsSettings->headers->Host)) $config['host'] = $wsSettings->headers->Host;
|
if (isset($wsSettings->headers->Host)) $config['host'] = $wsSettings->headers->Host;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user