From 83f82cfbee249cf6a175136c6812655114ee25f1 Mon Sep 17 00:00:00 2001 From: gosip443 <68860284+gosip443@users.noreply.github.com> Date: Wed, 26 Jan 2022 21:37:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=96=B0=E8=80=81=E7=89=88?= =?UTF-8?q?=E6=9C=ACclash=20ws=E6=A8=A1=E5=BC=8F=E8=AE=BE=E5=AE=9A=20(#212?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add ws-headers check 兼容新老版本clash Co-authored-by: ZBrettonYe --- app/Components/Client/Clash.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Components/Client/Clash.php b/app/Components/Client/Clash.php index 72a2abd6..32b286ce 100644 --- a/app/Components/Client/Clash.php +++ b/app/Components/Client/Clash.php @@ -60,6 +60,12 @@ class Clash $array['network'] = $server['v2_net']; if ($server['v2_net'] === 'ws') { + $array['ws-opts'] = []; + $array['ws-opts']['path'] = $server['v2_path']; + if ($server['v2_host']) { + $array['ws-opts']['headers'] = ['Host' => $server['v2_host']]; + } + // TODO: 2022.06.01 remove it $array['ws-path'] = $server['v2_path']; if ($server['v2_host']) { $array['ws-headers'] = ['Host' => $server['v2_host']];