Merge pull request #308 from NekoCareLab/new

Fixed Vmess TCP for General and Clash/ClashMeta
This commit is contained in:
Xboard 2025-01-12 23:29:22 +08:00 committed by GitHub
commit efe8c2a96d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 11 deletions

View File

@ -159,10 +159,12 @@ class Clash implements ProtocolInterface
switch (data_get($protocol_settings, 'network')) { switch (data_get($protocol_settings, 'network')) {
case 'tcp': case 'tcp':
$array['network'] = data_get($protocol_settings, 'network_settings.header.type'); $array['network'] = data_get($protocol_settings, 'network_settings.header.type');
$array['http-opts'] = [ if (data_get($protocol_settings, 'network_settings.header.type', 'none') !== 'none') {
'headers' => data_get($protocol_settings, 'network_settings.header.request.headers'), $array['http-opts'] = [
'path' => \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', ['/'])) 'headers' => data_get($protocol_settings, 'network_settings.header.request.headers'),
]; 'path' => \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', ['/']))
];
}
break; break;
case 'ws': case 'ws':
$array['network'] = 'ws'; $array['network'] = 'ws';

View File

@ -158,10 +158,12 @@ class ClashMeta implements ProtocolInterface
switch (data_get($protocol_settings, 'network')) { switch (data_get($protocol_settings, 'network')) {
case 'tcp': case 'tcp':
$array['network'] = data_get($protocol_settings, 'network_settings.header.type', 'tcp'); $array['network'] = data_get($protocol_settings, 'network_settings.header.type', 'tcp');
$array['http-opts'] = [ if (data_get($protocol_settings, 'network_settings.header.type', 'none') !== 'none') {
'headers' => data_get($protocol_settings, 'network_settings.header.request.headers'), $array['http-opts'] = [
'path' => \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', ['/']), 1) 'headers' => data_get($protocol_settings, 'network_settings.header.request.headers'),
]; 'path' => \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', ['/']))
];
}
break; break;
case 'ws': case 'ws':
$array['network'] = 'ws'; $array['network'] = 'ws';

View File

@ -82,9 +82,11 @@ class General implements ProtocolInterface
switch ($protocol_settings['network']) { switch ($protocol_settings['network']) {
case 'tcp': case 'tcp':
$config['type'] = 'http'; if (data_get($protocol_settings, 'network_settings.header.type', 'none') !== 'none') {
$config['path'] = \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', ['/'])); $config['type'] = data_get($protocol_settings, 'network_settings.header.type', 'http');
$config['host'] = data_get($protocol_settings, 'network_settings.headers.Host') ? \Arr::random(data_get($protocol_settings, 'network_settings.headers.Host'),['/']) : null; $config['path'] = \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', ['/']));
$config['host'] = data_get($protocol_settings, 'network_settings.headers.Host') ? \Arr::random(data_get($protocol_settings, 'network_settings.headers.Host'), ['/']) : null;
}
break; break;
case 'ws': case 'ws':
$config['type'] = 'ws'; $config['type'] = 'ws';