Просмотр исходного кода

兼容新老版本clash ws模式设定 (#212)

* Add ws-headers check 兼容新老版本clash

Co-authored-by: ZBrettonYe <[email protected]>
gosip443 3 лет назад
Родитель
Сommit
83f82cfbee
1 измененных файлов с 6 добавлено и 0 удалено
  1. 6 0
      app/Components/Client/Clash.php

+ 6 - 0
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']];