mirror of
				https://github.com/v2board/v2board.git
				synced 2025-10-31 09:21:46 +08:00 
			
		
		
		
	Merge branch 'dev' of https://github.com/v2board/v2board into dev
This commit is contained in:
		| @@ -53,6 +53,17 @@ class ClientController extends Controller | |||||||
|         $uri = ''; |         $uri = ''; | ||||||
|         foreach ($server as $item) { |         foreach ($server as $item) { | ||||||
|             $uri .= "vmess=" . $item->host . ":" . $item->port . ", method=none, password=" . $user->v2ray_uuid . ", fast-open=false, udp-relay=false, tag=" . $item->name; |             $uri .= "vmess=" . $item->host . ":" . $item->port . ", method=none, password=" . $user->v2ray_uuid . ", fast-open=false, udp-relay=false, tag=" . $item->name; | ||||||
|  |             if ($item->tls) { | ||||||
|  |                 $tlsSettings = json_decode($item->tlsSettings); | ||||||
|  |                 $uri .= ', obfs=over-tls'; | ||||||
|  |                 if (isset($tlsSettings->allowInsecure)) { | ||||||
|  |                     // Default: tls-verification=true | ||||||
|  |                     $uri .= ', tls-verification=' . ($tlsSettings->allowInsecure ? "false" : "true"); | ||||||
|  |                 } | ||||||
|  |                 if (isset($tlsSettings->serverName)) { | ||||||
|  |                     $uri .= ', obfs-host=' . $tlsSettings->serverName; | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|             if ($item->network == 'ws') { |             if ($item->network == 'ws') { | ||||||
|                 $uri .= ', obfs=' . ($item->tls ? 'wss' : 'ws'); |                 $uri .= ', obfs=' . ($item->tls ? 'wss' : 'ws'); | ||||||
|                 if ($item->networkSettings) { |                 if ($item->networkSettings) { | ||||||
| @@ -106,7 +117,7 @@ class ClientController extends Controller | |||||||
|                 $tlsSettings = json_decode($item->tlsSettings); |                 $tlsSettings = json_decode($item->tlsSettings); | ||||||
|                 $proxies .= ', tls=' . ($item->tls ? "true" : "false"); |                 $proxies .= ', tls=' . ($item->tls ? "true" : "false"); | ||||||
|                 if (isset($tlsSettings->allowInsecure)) { |                 if (isset($tlsSettings->allowInsecure)) { | ||||||
|                   $proxies .= ', skip-cert-verify=true'; |                   $proxies .= ', skip-cert-verify=' . ($tlsSettings->allowInsecure ? "true" : "false"); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             if ($item->network == 'ws') { |             if ($item->network == 'ws') { | ||||||
| @@ -162,8 +173,9 @@ class ClientController extends Controller | |||||||
|             $array['alterId'] = $user->v2ray_alter_id; |             $array['alterId'] = $user->v2ray_alter_id; | ||||||
|             $array['cipher'] = 'auto'; |             $array['cipher'] = 'auto'; | ||||||
|             if ($item->tls) { |             if ($item->tls) { | ||||||
|  |                 $tlsSettings = json_decode($item->tlsSettings); | ||||||
|                 $array['tls'] = true; |                 $array['tls'] = true; | ||||||
|                 $array['skip-cert-verify'] = true; |                 if (isset($tlsSettings->allowInsecure)) $array['skip-cert-verify'] = ($tlsSettings->allowInsecure ? true : false ); | ||||||
|             } |             } | ||||||
|             if ($item->network == 'ws') { |             if ($item->network == 'ws') { | ||||||
|                 $array['network'] = $item->network; |                 $array['network'] = $item->network; | ||||||
|   | |||||||
| @@ -17,6 +17,13 @@ class PoseidonController extends Controller | |||||||
| { | { | ||||||
|     CONST SERVER_CONFIG = '{"api":{"services":["HandlerService","StatsService"],"tag":"api"},"stats":{},"inbound":{"port":443,"protocol":"vmess","settings":{"clients":[]},"sniffing":{"enabled": true,"destOverride": ["http","tls"]},"streamSettings":{"network":"tcp"},"tag":"proxy"},"inboundDetour":[{"listen":"0.0.0.0","port":23333,"protocol":"dokodemo-door","settings":{"address":"0.0.0.0"},"tag":"api"}],"log":{"loglevel":"debug","access":"access.log","error":"error.log"},"outbound":{"protocol":"freedom","settings":{}},"outboundDetour":[{"protocol":"blackhole","settings":{},"tag":"block"}],"routing":{"rules":[{"inboundTag":"api","outboundTag":"api","type":"field"}]},"policy":{"levels":{"0":{"handshake":4,"connIdle":300,"uplinkOnly":5,"downlinkOnly":30,"statsUserUplink":true,"statsUserDownlink":true}}}}'; |     CONST SERVER_CONFIG = '{"api":{"services":["HandlerService","StatsService"],"tag":"api"},"stats":{},"inbound":{"port":443,"protocol":"vmess","settings":{"clients":[]},"sniffing":{"enabled": true,"destOverride": ["http","tls"]},"streamSettings":{"network":"tcp"},"tag":"proxy"},"inboundDetour":[{"listen":"0.0.0.0","port":23333,"protocol":"dokodemo-door","settings":{"address":"0.0.0.0"},"tag":"api"}],"log":{"loglevel":"debug","access":"access.log","error":"error.log"},"outbound":{"protocol":"freedom","settings":{}},"outboundDetour":[{"protocol":"blackhole","settings":{},"tag":"block"}],"routing":{"rules":[{"inboundTag":"api","outboundTag":"api","type":"field"}]},"policy":{"levels":{"0":{"handshake":4,"connIdle":300,"uplinkOnly":5,"downlinkOnly":30,"statsUserUplink":true,"statsUserDownlink":true}}}}'; | ||||||
|  |  | ||||||
|  |     public $poseidonVersion; | ||||||
|  |  | ||||||
|  |     public function __construct(Request $request) | ||||||
|  |     { | ||||||
|  |         $this->poseidonVersion = $request->input('poseidon_version'); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     // 后端获取用户 |     // 后端获取用户 | ||||||
|     public function user(Request $request) |     public function user(Request $request) | ||||||
|     { |     { | ||||||
| @@ -100,6 +107,20 @@ class PoseidonController extends Controller | |||||||
|             $json->poseidon = [ |             $json->poseidon = [ | ||||||
|               'license_key' => (string)config('v2board.server_license'), |               'license_key' => (string)config('v2board.server_license'), | ||||||
|             ]; |             ]; | ||||||
|  |             if ($this->poseidonVersion >= 'v1.5.0') { | ||||||
|  |                 // don't need it after v1.5.0 | ||||||
|  |                 unset($json->inboundDetour); | ||||||
|  |                 unset($json->stats); | ||||||
|  |                 unset($json->api); | ||||||
|  |                 array_shift($json->routing->rules); | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             foreach($json->policy->levels as &$level) { | ||||||
|  |                 $level->handshake = 2; | ||||||
|  |                 $level->uplinkOnly = 2; | ||||||
|  |                 $level->downlinkOnly = 2; | ||||||
|  |                 $level->connIdle = 60; | ||||||
|  |             } | ||||||
|  |  | ||||||
|             return $this->success($json); |             return $this->success($json); | ||||||
|         } catch (\Exception $e) { |         } catch (\Exception $e) { | ||||||
|   | |||||||
| @@ -74,6 +74,9 @@ class TutorialController extends Controller | |||||||
|             base64_encode($response['data']['safe_area_var']['subscribe_url']) |             base64_encode($response['data']['safe_area_var']['subscribe_url']) | ||||||
|         ); |         ); | ||||||
| 	// end | 	// end | ||||||
|  | 	// fuck support surge urlencode subscribe | ||||||
|  | 	$response['data']['safe_area_var']['ue_subscribe_url'] = urlencode($response['data']['safe_area_var']['subscribe_url']); | ||||||
|  | 	// end | ||||||
|         return response($response); |         return response($response); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user