update: Support TCP-HTTP sub rules

This commit is contained in:
Cp0204 2023-03-27 21:53:52 +08:00
parent d4ac203805
commit f9e79018d8
9 changed files with 49 additions and 0 deletions

View File

@ -129,6 +129,11 @@ class Clash
$array['servername'] = $tlsSettings['serverName']; $array['servername'] = $tlsSettings['serverName'];
} }
} }
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 ($server['network'] === 'ws') { if ($server['network'] === 'ws') {
$array['network'] = 'ws'; $array['network'] = 'ws';
if ($server['networkSettings']) { if ($server['networkSettings']) {

View File

@ -128,6 +128,11 @@ class ClashMeta
$array['servername'] = $tlsSettings['serverName']; $array['servername'] = $tlsSettings['serverName'];
} }
} }
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 ($server['network'] === 'ws') { if ($server['network'] === 'ws') {
$array['network'] = 'ws'; $array['network'] = 'ws';
if ($server['networkSettings']) { if ($server['networkSettings']) {

View File

@ -80,6 +80,11 @@ class General
$config['sni'] = $tlsSettings['serverName']; $config['sni'] = $tlsSettings['serverName'];
} }
} }
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 ((string)$server['network'] === 'ws') { if ((string)$server['network'] === 'ws') {
$wsSettings = $server['networkSettings']; $wsSettings = $server['networkSettings'];
if (isset($wsSettings['path'])) $config['path'] = $wsSettings['path']; if (isset($wsSettings['path'])) $config['path'] = $wsSettings['path'];

View File

@ -68,6 +68,11 @@ class Passwall
$config['sni'] = $tlsSettings['serverName']; $config['sni'] = $tlsSettings['serverName'];
} }
} }
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 ((string)$server['network'] === 'ws') { if ((string)$server['network'] === 'ws') {
$wsSettings = $server['networkSettings']; $wsSettings = $server['networkSettings'];
if (isset($wsSettings['path'])) $config['path'] = $wsSettings['path']; if (isset($wsSettings['path'])) $config['path'] = $wsSettings['path'];

View File

@ -72,6 +72,11 @@ class SagerNet
$config['sni'] = urlencode($tlsSettings['serverName']); $config['sni'] = urlencode($tlsSettings['serverName']);
} }
} }
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 ((string)$server['network'] === 'ws') { if ((string)$server['network'] === 'ws') {
$wsSettings = $server['networkSettings']; $wsSettings = $server['networkSettings'];
if (isset($wsSettings['path'])) $config['path'] = $wsSettings['path']; if (isset($wsSettings['path'])) $config['path'] = $wsSettings['path'];

View File

@ -82,6 +82,15 @@ class Shadowrocket
$config['peer'] = $tlsSettings['serverName']; $config['peer'] = $tlsSettings['serverName'];
} }
} }
if ($server['network'] === 'tcp') {
if ($server['networkSettings']) {
$tcpSettings = $server['networkSettings'];
if (isset($tcpSettings['header']['type']) && !empty($tcpSettings['header']['type']))
$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 ($server['network'] === 'ws') { if ($server['network'] === 'ws') {
$config['obfs'] = "websocket"; $config['obfs'] = "websocket";
if ($server['networkSettings']) { if ($server['networkSettings']) {

View File

@ -125,6 +125,11 @@ class Stash
$array['servername'] = $tlsSettings['serverName']; $array['servername'] = $tlsSettings['serverName'];
} }
} }
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 ($server['network'] === 'ws') { if ($server['network'] === 'ws') {
$array['network'] = 'ws'; $array['network'] = 'ws';
if ($server['networkSettings']) { if ($server['networkSettings']) {

View File

@ -80,6 +80,11 @@ class V2rayN
$config['sni'] = $tlsSettings['serverName']; $config['sni'] = $tlsSettings['serverName'];
} }
} }
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 ((string)$server['network'] === 'ws') { if ((string)$server['network'] === 'ws') {
$wsSettings = $server['networkSettings']; $wsSettings = $server['networkSettings'];
if (isset($wsSettings['path'])) $config['path'] = $wsSettings['path']; if (isset($wsSettings['path'])) $config['path'] = $wsSettings['path'];

View File

@ -68,6 +68,11 @@ class V2rayNG
$config['sni'] = $tlsSettings['serverName']; $config['sni'] = $tlsSettings['serverName'];
} }
} }
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 ((string)$server['network'] === 'ws') { if ((string)$server['network'] === 'ws') {
$wsSettings = $server['networkSettings']; $wsSettings = $server['networkSettings'];
if (isset($wsSettings['path'])) $config['path'] = $wsSettings['path']; if (isset($wsSettings['path'])) $config['path'] = $wsSettings['path'];