1
0
Эх сурвалжийг харах

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

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

Co-authored-by: ZBrettonYe <[email protected]>
gosip443 3 жил өмнө
parent
commit
83f82cfbee

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