mirror of
https://github.com/v2board/v2board.git
synced 2025-06-14 13:47:49 +08:00
update: server
This commit is contained in:
@ -8,10 +8,10 @@ class Surfboard
|
||||
public static function buildShadowsocks($password, $server)
|
||||
{
|
||||
$config = [
|
||||
"{$server->name}=custom",
|
||||
"{$server->host}",
|
||||
"{$server->port}",
|
||||
"{$server->cipher}",
|
||||
"{$server['name']}=custom",
|
||||
"{$server['host']}",
|
||||
"{$server['port']}",
|
||||
"{$server['cipher']}",
|
||||
"{$password}",
|
||||
'https://raw.githubusercontent.com/Hackl0us/proxy-tool-backup/master/SSEncrypt.module',
|
||||
'tfo=true',
|
||||
@ -26,36 +26,36 @@ class Surfboard
|
||||
public static function buildVmess($uuid, $server)
|
||||
{
|
||||
$config = [
|
||||
"{$server->name}=vmess",
|
||||
"{$server->host}",
|
||||
"{$server->port}",
|
||||
"{$server['name']}=vmess",
|
||||
"{$server['host']}",
|
||||
"{$server['port']}",
|
||||
"username={$uuid}",
|
||||
'tfo=true',
|
||||
'udp-relay=true'
|
||||
];
|
||||
if ($server->network === 'tcp') {
|
||||
if ($server->tls) {
|
||||
$tlsSettings = json_decode($server->tlsSettings);
|
||||
array_push($config, $server->tls ? 'tls=true' : 'tls=false');
|
||||
if (!empty($tlsSettings->allowInsecure)) {
|
||||
array_push($config, $tlsSettings->allowInsecure ? 'skip-cert-verify=true' : 'skip-cert-verify=false');
|
||||
if ($server['network'] === 'tcp') {
|
||||
if ($server['tls']) {
|
||||
$tlsSettings = json_decode($server['tlsSettings'], true);
|
||||
array_push($config, $server['tls'] ? 'tls=true' : 'tls=false');
|
||||
if (!empty($tlsSettings['allowInsecure'])) {
|
||||
array_push($config, $tlsSettings['allowInsecure'] ? 'skip-cert-verify=true' : 'skip-cert-verify=false');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($server->network === 'ws') {
|
||||
if ($server['network'] === 'ws') {
|
||||
array_push($config, 'ws=true');
|
||||
if ($server->tls) {
|
||||
$tlsSettings = json_decode($server->tlsSettings);
|
||||
array_push($config, $server->tls ? 'tls=true' : 'tls=false');
|
||||
if (!empty($tlsSettings->allowInsecure)) {
|
||||
array_push($config, $tlsSettings->allowInsecure ? 'skip-cert-verify=true' : 'skip-cert-verify=false');
|
||||
if ($server['tls']) {
|
||||
$tlsSettings = json_decode($server['tlsSettings'], true);
|
||||
array_push($config, $server['tls'] ? 'tls=true' : 'tls=false');
|
||||
if (!empty($tlsSettings['allowInsecure'])) {
|
||||
array_push($config, $tlsSettings['allowInsecure'] ? 'skip-cert-verify=true' : 'skip-cert-verify=false');
|
||||
}
|
||||
}
|
||||
if ($server->networkSettings) {
|
||||
$wsSettings = json_decode($server->networkSettings);
|
||||
if (isset($wsSettings->path)) array_push($config, "ws-path={$wsSettings->path}");
|
||||
if (isset($wsSettings->headers->Host)) array_push($config, "ws-headers=host:{$wsSettings->headers->Host}");
|
||||
if ($server['networkSettings']) {
|
||||
$wsSettings = json_decode($server['networkSettings'], true);
|
||||
if (isset($wsSettings['path'])) array_push($config, "ws-path={$wsSettings['path']}");
|
||||
if (isset($wsSettings['headers']['Host'])) array_push($config, "ws-headers=host:{$wsSettings['headers']['Host']}");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user