diff --git a/app/Protocols/Clash.php b/app/Protocols/Clash.php index b5a1de0..a7be5e3 100644 --- a/app/Protocols/Clash.php +++ b/app/Protocols/Clash.php @@ -136,7 +136,15 @@ class Clash if ($server['network'] === 'tcp') { $tcpSettings = $server['networkSettings']; if (isset($tcpSettings['header']['type'])) $array['network'] = $tcpSettings['header']['type']; - if (isset($tcpSettings['header']['request']['path'][0])) $array['http-opts']['path'] = $tcpSettings['header']['request']['path'][0]; + + if (isset($tcpSettings['header']['request']['headers'])){ + $headers = $$tcpSettings['header']['request']['headers']; + $array['http-opts']['headers'] = $headers; + } + if (isset($tcpSettings['header']['request']['path'][0])){ + $paths = $tcpSettings['header']['request']['path']; + $array['http-opts']['path'] = $paths; + } } if ($server['network'] === 'ws') { $array['network'] = 'ws'; diff --git a/app/Protocols/ClashMeta.php b/app/Protocols/ClashMeta.php index f7fc52f..35cd1cc 100644 --- a/app/Protocols/ClashMeta.php +++ b/app/Protocols/ClashMeta.php @@ -140,7 +140,15 @@ class ClashMeta if ($server['network'] === 'tcp') { $tcpSettings = $server['networkSettings']; if (isset($tcpSettings['header']['type'])) $array['network'] = $tcpSettings['header']['type']; - if (isset($tcpSettings['header']['request']['path'][0])) $array['http-opts']['path'] = $tcpSettings['header']['request']['path'][0]; + + if (isset($tcpSettings['header']['request']['headers'])){ + $headers = $$tcpSettings['header']['request']['headers']; + $array['http-opts']['headers'] = $headers; + } + if (isset($tcpSettings['header']['request']['path'][0])){ + $paths = $tcpSettings['header']['request']['path']; + $array['http-opts']['path'] = $paths; + } } if ($server['network'] === 'ws') { $array['network'] = 'ws'; diff --git a/app/Protocols/General.php b/app/Protocols/General.php index 2279c01..99bbf20 100644 --- a/app/Protocols/General.php +++ b/app/Protocols/General.php @@ -86,7 +86,14 @@ class General if ((string)$server['network'] === 'tcp') { $tcpSettings = $server['networkSettings']; if (isset($tcpSettings['header']['type'])) $config['type'] = $tcpSettings['header']['type']; - if (isset($tcpSettings['header']['request']['path'][0])) $config['path'] = $tcpSettings['header']['request']['path'][0]; + if (isset($tcpSettings['header']['request']['path'][0])){ + $paths = $tcpSettings['header']['request']['path']; + $config['path'] = $paths[array_rand($paths)]; + } + if (isset($tcpSettings['header']['request']['headers']['Host'][0])){ + $hosts = $tcpSettings['header']['request']['headers']['Host']; + $config['host'] = $hosts[array_rand($hosts)]; + } } if ((string)$server['network'] === 'ws') { $wsSettings = $server['networkSettings']; diff --git a/app/Protocols/Loon.php b/app/Protocols/Loon.php index 20cba66..fb9e389 100644 --- a/app/Protocols/Loon.php +++ b/app/Protocols/Loon.php @@ -84,9 +84,14 @@ class Loon if (isset($tcpSettings['header']['type']) && !empty($tcpSettings['header']['type'])) $config = str_replace('transport=tcp', "transport={$tcpSettings['header']['type']}", $config); if (isset($tcpSettings['header']['request']['path'][0]) && !empty($tcpSettings['header']['request']['path'][0])) - array_push($config, "path={$tcpSettings['header']['request']['path'][0]}"); - if (isset($tcpSettings['header']['Host']) && !empty($tcpSettings['header']['Host'])) - array_push($config, "host={$tcpSettings['header']['Host']}"); + $paths = $tcpSettings['header']['request']['path']; + $path = array_rand(array_rand($paths)); + array_push($config, "path={$path}"); + if (isset($tcpSettings['header']['request']['headers']['Host'][0])){ + $hosts = $tcpSettings['header']['request']['headers']['Host']; + $host = $hosts[array_rand($hosts)]; + array_push($config, "host={$host}"); + } } } if ($server['tls']) { diff --git a/app/Protocols/Passwall.php b/app/Protocols/Passwall.php index a08ff40..a393c6b 100644 --- a/app/Protocols/Passwall.php +++ b/app/Protocols/Passwall.php @@ -74,7 +74,14 @@ class Passwall if ((string)$server['network'] === 'tcp') { $tcpSettings = $server['networkSettings']; if (isset($tcpSettings['header']['type'])) $config['type'] = $tcpSettings['header']['type']; - if (isset($tcpSettings['header']['request']['path'][0])) $config['path'] = $tcpSettings['header']['request']['path'][0]; + if (isset($tcpSettings['header']['request']['path'][0])){ + $paths = $tcpSettings['header']['request']['path']; + $config['path'] = $paths[array_rand($paths)]; + } + if (isset($tcpSettings['header']['request']['headers']['Host'][0])){ + $hosts = $tcpSettings['header']['request']['headers']['Host']; + $config['host'] = $hosts[array_rand($hosts)]; + } } if ((string)$server['network'] === 'ws') { $wsSettings = $server['networkSettings']; diff --git a/app/Protocols/Shadowrocket.php b/app/Protocols/Shadowrocket.php index eb07f5c..69c40e1 100644 --- a/app/Protocols/Shadowrocket.php +++ b/app/Protocols/Shadowrocket.php @@ -185,6 +185,10 @@ class Shadowrocket $config['obfs'] = $tcpSettings['header']['type']; if (isset($tcpSettings['header']['request']['path'][0]) && !empty($tcpSettings['header']['request']['path'][0])) $config['path'] = $tcpSettings['header']['request']['path'][0]; + if (isset($tcpSettings['header']['request']['headers']['Host'][0])){ + $hosts = $tcpSettings['header']['request']['headers']['Host']; + $config['obfsParam'] = $hosts[array_rand($hosts)]; + } } } if ($server['network'] === 'ws') { diff --git a/app/Protocols/SingBox.php b/app/Protocols/SingBox.php index abad5bc..55d8e6d 100644 --- a/app/Protocols/SingBox.php +++ b/app/Protocols/SingBox.php @@ -147,7 +147,14 @@ class SingBox if ($server['network'] === 'tcp') { $tcpSettings = $server['networkSettings']; if (isset($tcpSettings['header']['type']) && $tcpSettings['header']['type'] == 'http') $array['transport']['type'] = $tcpSettings['header']['type']; - if (isset($tcpSettings['header']['request']['path'])) $array['transport']['path'] = $tcpSettings['header']['request']['path']; + if (isset($tcpSettings['header']['request']['path'][0])){ + $paths = $tcpSettings['header']['request']['path']; + $array['transport']['path'] = $paths[array_rand($paths)]; + } + if (isset($tcpSettings['header']['request']['headers']['Host'][0])){ + $hosts = $tcpSettings['header']['request']['headers']['Host']; + $array['transport']['host'] = $hosts; + } } if ($server['network'] === 'ws') { $array['transport']['type'] ='ws'; diff --git a/app/Protocols/Stash.php b/app/Protocols/Stash.php index b469593..af95b9b 100644 --- a/app/Protocols/Stash.php +++ b/app/Protocols/Stash.php @@ -205,7 +205,17 @@ class Stash } if ($server['network'] === 'tcp') { - $tcpSettings = $server['network_settings']; + $tcpSettings = $server['networkSettings']; + if (isset($tcpSettings['header']['type']) && $tcpSettings['header']['type'] == 'http') { + $array['network'] = $tcpSettings['header']['type']; + if (isset($tcpSettings['header']['request']['headers']['Host'])){ + $array['http-opts']['headers']['Host'] = $tcpSettings['header']['request']['headers']['Host']; + } + if (isset($tcpSettings['header']['request']['path'][0])){ + $paths = $tcpSettings['header']['request']['path']; + $array['http-opts']['path'] = $paths[array_rand($paths)]; + }; + } } if ($server['network'] === 'ws') { diff --git a/app/Protocols/V2rayN.php b/app/Protocols/V2rayN.php index 61fc1c1..9d62f36 100644 --- a/app/Protocols/V2rayN.php +++ b/app/Protocols/V2rayN.php @@ -87,7 +87,14 @@ class V2rayN if ((string)$server['network'] === 'tcp') { $tcpSettings = $server['networkSettings']; if (isset($tcpSettings['header']['type'])) $config['type'] = $tcpSettings['header']['type']; - if (isset($tcpSettings['header']['request']['path'][0])) $config['path'] = $tcpSettings['header']['request']['path'][0]; + if (isset($tcpSettings['header']['request']['path'][0])){ + $paths = $tcpSettings['header']['request']['path']; + $config['path'] = $paths[array_rand($paths)]; + } + if (isset($tcpSettings['header']['request']['headers']['Host'][0])){ + $hosts = $tcpSettings['header']['request']['headers']['Host']; + $config['host'] = $hosts[array_rand($hosts)]; + } } if ((string)$server['network'] === 'ws') { $wsSettings = $server['networkSettings']; @@ -137,7 +144,7 @@ class V2rayN $config['servername'] = $tls_settings['server_name']; $config['spx'] = "/"; $fingerprints = ['chrome', 'firefox', 'safari', 'ios', 'edge', 'qq']; //随机客户端指纹 - $config['fp'] = $fingerprints[rand(0,count($fingerprints) - 1)]; + $config['fp'] = $fingerprints[array_rand($fingerprints)]; }; break; } diff --git a/app/Protocols/V2rayNG.php b/app/Protocols/V2rayNG.php index 809585f..7ed5285 100644 --- a/app/Protocols/V2rayNG.php +++ b/app/Protocols/V2rayNG.php @@ -74,7 +74,14 @@ class V2rayNG if ((string)$server['network'] === 'tcp') { $tcpSettings = $server['networkSettings']; if (isset($tcpSettings['header']['type'])) $config['type'] = $tcpSettings['header']['type']; - if (isset($tcpSettings['header']['request']['path'][0])) $config['path'] = $tcpSettings['header']['request']['path'][0]; + if (isset($tcpSettings['header']['request']['path'][0])){ + $paths = $tcpSettings['header']['request']['path']; + $config['path'] = $paths[array_rand($paths)]; + } + if (isset($tcpSettings['header']['request']['headers']['Host'][0])){ + $hosts = $tcpSettings['header']['request']['headers']['Host']; + $config['host'] = $hosts[array_rand($hosts)]; + } } if ((string)$server['network'] === 'ws') { $wsSettings = $server['networkSettings'];