feat: 增加Vmess tcp http下发支持

This commit is contained in:
xboard 2023-12-18 09:40:35 +08:00
parent 0ef19e91bb
commit 9dcb9cee32
10 changed files with 82 additions and 12 deletions

View File

@ -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';

View File

@ -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';

View File

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

View File

@ -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']) {

View File

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

View File

@ -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') {

View File

@ -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';

View File

@ -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') {

View File

@ -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;
}

View File

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