mirror of
				https://github.com/v2board/v2board.git
				synced 2025-10-31 09:21:46 +08:00 
			
		
		
		
	update: support shadowsocks app subscribe
This commit is contained in:
		| @@ -5,6 +5,17 @@ namespace App\Utils; | ||||
|  | ||||
| class Shadowrocket | ||||
| { | ||||
|     public static function buildShadowsocks($password, $server) | ||||
|     { | ||||
|         $name = rawurlencode($server->name); | ||||
|         $str = str_replace( | ||||
|             ['+', '/', '='], | ||||
|             ['-', '_', ''], | ||||
|             base64_encode("{$server->cipher}:{$password}") | ||||
|         ); | ||||
|         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); | ||||
| @@ -31,12 +42,12 @@ class Shadowrocket | ||||
|  | ||||
|     public static function buildTrojan($password, $server) | ||||
|     { | ||||
|         $server->name = rawurlencode($server->name); | ||||
|         $name = rawurlencode($server->name); | ||||
|         $query = http_build_query([ | ||||
|             'allowInsecure' => $server->allow_insecure, | ||||
|             'peer' => $server->server_name | ||||
|         ]); | ||||
|         $uri = "trojan://{$password}@{$server->host}:{$server->port}?{$query}&tfo=1#{$server->name}"; | ||||
|         $uri = "trojan://{$password}@{$server->host}:{$server->port}?{$query}&tfo=1#{$name}"; | ||||
|         $uri .= "\r\n"; | ||||
|         return $uri; | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user