From 676e6bc57c020888f96ae3e22531a9107b6169b0 Mon Sep 17 00:00:00 2001 From: NekoCareLab <194696930+NekoCareLab@users.noreply.github.com> Date: Sun, 12 Jan 2025 23:16:55 +0800 Subject: [PATCH 1/2] Fixed Vmess TCP --- app/Protocols/General.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Protocols/General.php b/app/Protocols/General.php index 548d21e..189a9d0 100644 --- a/app/Protocols/General.php +++ b/app/Protocols/General.php @@ -82,9 +82,11 @@ class General implements ProtocolInterface switch ($protocol_settings['network']) { case 'tcp': - $config['type'] = 'http'; - $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; + if (data_get($protocol_settings, 'network_settings.header.type', 'none') !== 'none') { + $config['type'] = data_get($protocol_settings, 'network_settings.header.type', 'http'); + $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; case 'ws': $config['type'] = 'ws'; From 4433dbb5203882afa70c2e7d446610fe15ea98be Mon Sep 17 00:00:00 2001 From: NekoCareLab <194696930+NekoCareLab@users.noreply.github.com> Date: Sun, 12 Jan 2025 23:22:00 +0800 Subject: [PATCH 2/2] Fixed Vmess TCP for clash and clashmeta --- app/Protocols/Clash.php | 10 ++++++---- app/Protocols/ClashMeta.php | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/app/Protocols/Clash.php b/app/Protocols/Clash.php index ca649af..ea107c0 100644 --- a/app/Protocols/Clash.php +++ b/app/Protocols/Clash.php @@ -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'; diff --git a/app/Protocols/ClashMeta.php b/app/Protocols/ClashMeta.php index 8153880..941a031 100644 --- a/app/Protocols/ClashMeta.php +++ b/app/Protocols/ClashMeta.php @@ -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';