Fixed Vmess TCP for clash and clashmeta

This commit is contained in:
NekoCareLab 2025-01-12 23:22:00 +08:00
parent 676e6bc57c
commit 4433dbb520
No known key found for this signature in database
2 changed files with 12 additions and 8 deletions

View File

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

View File

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