From d020ddf926b43a113b3f33875ed3e3e1979ead90 Mon Sep 17 00:00:00 2001 From: Tokumeikoi Date: Sat, 30 May 2020 19:52:43 +0800 Subject: [PATCH] fix --- .../Controllers/Client/ClientController.php | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/app/Http/Controllers/Client/ClientController.php b/app/Http/Controllers/Client/ClientController.php index aaea3f11..94c6f30d 100644 --- a/app/Http/Controllers/Client/ClientController.php +++ b/app/Http/Controllers/Client/ClientController.php @@ -53,25 +53,24 @@ class ClientController extends Controller $uri = ''; 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; - if ($item->network == 'ws') { + if ($item->tls) { + $tlsSettings = json_decode($item->tlsSettings); + if ($item->network === 'tcp') $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') { $uri .= ', obfs=' . ($item->tls ? 'wss' : 'ws'); if ($item->networkSettings) { $wsSettings = json_decode($item->networkSettings); if (isset($wsSettings->path)) $uri .= ', obfs-uri=' . $wsSettings->path; if (isset($wsSettings->headers->Host)) $uri .= ', obfs-host=' . $wsSettings->headers->Host; } - } else { - 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; - } - } } $uri .= "\r\n"; }