mirror of
				https://github.com/v2board/v2board.git
				synced 2025-11-01 01:41:47 +08:00 
			
		
		
		
	update: server
This commit is contained in:
		| @@ -7,32 +7,32 @@ class Shadowrocket | ||||
| { | ||||
|     public static function buildShadowsocks($password, $server) | ||||
|     { | ||||
|         $name = rawurlencode($server->name); | ||||
|         $name = rawurlencode($server['name']); | ||||
|         $str = str_replace( | ||||
|             ['+', '/', '='], | ||||
|             ['-', '_', ''], | ||||
|             base64_encode("{$server->cipher}:{$password}") | ||||
|             base64_encode("{$server['cipher']}:{$password}") | ||||
|         ); | ||||
|         return "ss://{$str}@{$server->host}:{$server->port}#{$name}\r\n"; | ||||
|         return "ss://{$str}@{$server['host']}:{$server['port']}#{$name}\r\n"; | ||||
|     } | ||||
|  | ||||
|     public static function buildVmess($uuid, $server) | ||||
|     { | ||||
|         $userinfo = base64_encode('auto:' . $uuid . '@' . $server->host . ':' . $server->port); | ||||
|         $userinfo = base64_encode('auto:' . $uuid . '@' . $server['host'] . ':' . $server['port']); | ||||
|         $config = [ | ||||
|             'remark' => $server->name | ||||
|             'remark' => $server['name'] | ||||
|         ]; | ||||
|         if ($server->tls) { | ||||
|             $tlsSettings = json_decode($server->tlsSettings); | ||||
|         if ($server['tls']) { | ||||
|             $tlsSettings = json_decode($server['tlsSettings'], true); | ||||
|             $config['tls'] = 1; | ||||
|             if (isset($tlsSettings->serverName)) $config['peer'] = $tlsSettings->serverName; | ||||
|             if (isset($tlsSettings->allowInsecure)) $config['allowInsecure'] = 1; | ||||
|             if (isset($tlsSettings['serverName'])) $config['peer'] = $tlsSettings['serverName']; | ||||
|             if (isset($tlsSettings['allowInsecure'])) $config['allowInsecure'] = 1; | ||||
|         } | ||||
|         if ($server->network === 'ws') { | ||||
|             $wsSettings = json_decode($server->networkSettings); | ||||
|         if ($server['network'] === 'ws') { | ||||
|             $wsSettings = json_decode($server['networkSettings'], true); | ||||
|             $config['obfs'] = "websocket"; | ||||
|             if (isset($wsSettings->path)) $config['path'] = $wsSettings->path; | ||||
|             if (isset($wsSettings->headers->Host)) $config['obfsParam'] = $wsSettings->headers->Host; | ||||
|             if (isset($wsSettings['path'])) $config['path'] = $wsSettings['path']; | ||||
|             if (isset($wsSettings['headers']['Host'])) $config['obfsParam'] = $wsSettings['headers']['Host']; | ||||
|         } | ||||
|         $query = http_build_query($config, null, '&', PHP_QUERY_RFC3986); | ||||
|         $uri = "vmess://{$userinfo}?{$query}&tfo=1"; | ||||
| @@ -42,12 +42,12 @@ class Shadowrocket | ||||
|  | ||||
|     public static function buildTrojan($password, $server) | ||||
|     { | ||||
|         $name = rawurlencode($server->name); | ||||
|         $name = rawurlencode($server['name']); | ||||
|         $query = http_build_query([ | ||||
|             'allowInsecure' => $server->allow_insecure, | ||||
|             'peer' => $server->server_name | ||||
|             'allowInsecure' => $server['allow_insecure'], | ||||
|             'peer' => $server['server_name'] | ||||
|         ]); | ||||
|         $uri = "trojan://{$password}@{$server->host}:{$server->port}?{$query}&tfo=1#{$name}"; | ||||
|         $uri = "trojan://{$password}@{$server['host']}:{$server['port']}?{$query}&tfo=1#{$name}"; | ||||
|         $uri .= "\r\n"; | ||||
|         return $uri; | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user