mirror of
				https://github.com/v2board/v2board.git
				synced 2025-10-31 17:31:49 +08:00 
			
		
		
		
	update: server
This commit is contained in:
		| @@ -8,12 +8,12 @@ class QuantumultX | ||||
|     public static function buildShadowsocks($password, $server) | ||||
|     { | ||||
|         $config = [ | ||||
|             "shadowsocks={$server->host}:{$server->port}", | ||||
|             "method={$server->cipher}", | ||||
|             "shadowsocks={$server['host']}:{$server['port']}", | ||||
|             "method={$server['cipher']}", | ||||
|             "password={$password}", | ||||
|             'fast-open=true', | ||||
|             'udp-relay=true', | ||||
|             "tag={$server->name}" | ||||
|             "tag={$server['name']}" | ||||
|         ]; | ||||
|         $config = array_filter($config); | ||||
|         $uri = implode(',', $config); | ||||
| @@ -24,41 +24,41 @@ class QuantumultX | ||||
|     public static function buildVmess($uuid, $server) | ||||
|     { | ||||
|         $config = [ | ||||
|             "vmess={$server->host}:{$server->port}", | ||||
|             "vmess={$server['host']}:{$server['port']}", | ||||
|             'method=chacha20-poly1305', | ||||
|             "password={$uuid}", | ||||
|             'fast-open=true', | ||||
|             'udp-relay=true', | ||||
|             "tag={$server->name}" | ||||
|             "tag={$server['name']}" | ||||
|         ]; | ||||
|         if ($server->network === 'tcp') { | ||||
|             if ($server->tls) { | ||||
|                 $tlsSettings = json_decode($server->tlsSettings); | ||||
|         if ($server['network'] === 'tcp') { | ||||
|             if ($server['tls']) { | ||||
|                 $tlsSettings = json_decode($server['tlsSettings'], true); | ||||
|                 array_push($config, 'obfs=over-tls'); | ||||
|                 if (isset($tlsSettings->allowInsecure)) { | ||||
|                 if (isset($tlsSettings['allowInsecure'])) { | ||||
|                     // Tips: allowInsecure=false = tls-verification=true | ||||
|                     array_push($config, $tlsSettings->allowInsecure ? 'tls-verification=false' : 'tls-verification=true'); | ||||
|                     array_push($config, $tlsSettings['allowInsecure'] ? 'tls-verification=false' : 'tls-verification=true'); | ||||
|                 } | ||||
|                 if (!empty($tlsSettings->serverName)) { | ||||
|                     array_push($config, "obfs-host={$tlsSettings->serverName}"); | ||||
|                 if (!empty($tlsSettings['serverName'])) { | ||||
|                     array_push($config, "obfs-host={$tlsSettings['serverName']}"); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         if ($server->network === 'ws') { | ||||
|             if ($server->tls) { | ||||
|                 $tlsSettings = json_decode($server->tlsSettings); | ||||
|         if ($server['network'] === 'ws') { | ||||
|             if ($server['tls']) { | ||||
|                 $tlsSettings = json_decode($server['tlsSettings'], true); | ||||
|                 array_push($config, 'obfs=wss'); | ||||
|                 if (isset($tlsSettings->allowInsecure)) { | ||||
|                     array_push($config, $tlsSettings->allowInsecure ? 'tls-verification=false' : 'tls-verification=true'); | ||||
|                 if (isset($tlsSettings['allowInsecure'])) { | ||||
|                     array_push($config, $tlsSettings['allowInsecure'] ? 'tls-verification=false' : 'tls-verification=true'); | ||||
|                 } | ||||
|             } else { | ||||
|                 array_push($config, 'obfs=ws'); | ||||
|             } | ||||
|             if ($server->networkSettings) { | ||||
|                 $wsSettings = json_decode($server->networkSettings); | ||||
|                 if (isset($wsSettings->path)) array_push($config, "obfs-uri={$wsSettings->path}"); | ||||
|                 if (isset($wsSettings->headers->Host)) array_push($config, "obfs-host={$wsSettings->headers->Host}"); | ||||
|             if ($server['networkSettings']) { | ||||
|                 $wsSettings = json_decode($server['networkSettings'], true); | ||||
|                 if (isset($wsSettings['path'])) array_push($config, "obfs-uri={$wsSettings['path']}"); | ||||
|                 if (isset($wsSettings['headers']['Host'])) array_push($config, "obfs-host={$wsSettings['headers']['Host']}"); | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @@ -70,15 +70,15 @@ class QuantumultX | ||||
|     public static function buildTrojan($password, $server) | ||||
|     { | ||||
|         $config = [ | ||||
|             "trojan={$server->host}:{$server->port}", | ||||
|             "trojan={$server['host']}:{$server['port']}", | ||||
|             "password={$password}", | ||||
|             'over-tls=true', | ||||
|             $server->server_name ? "tls-host={$server->server_name}" : "", | ||||
|             $server['server_name'] ? "tls-host={$server['server_name']}" : "", | ||||
|             // Tips: allowInsecure=false = tls-verification=true | ||||
|             $server->allow_insecure ? 'tls-verification=false' : 'tls-verification=true', | ||||
|             $server['allow_insecure'] ? 'tls-verification=false' : 'tls-verification=true', | ||||
|             'fast-open=true', | ||||
|             'udp-relay=true', | ||||
|             "tag={$server->name}" | ||||
|             "tag={$server['name']}" | ||||
|         ]; | ||||
|         $config = array_filter($config); | ||||
|         $uri = implode(',', $config); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user