From 3b9cc9952688691d256f003bb56fd2ad699776c9 Mon Sep 17 00:00:00 2001 From: NekoCareLab <194696930+NekoCareLab@users.noreply.github.com> Date: Mon, 13 Jan 2025 23:11:18 +0800 Subject: [PATCH 1/2] Protocol Shadowrocket: fixed a typo --- app/Protocols/Shadowrocket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Protocols/Shadowrocket.php b/app/Protocols/Shadowrocket.php index bd73893..e5cf69b 100644 --- a/app/Protocols/Shadowrocket.php +++ b/app/Protocols/Shadowrocket.php @@ -97,7 +97,7 @@ class Shadowrocket implements ProtocolInterface switch (data_get($protocol_settings, 'network')) { case 'tcp': $config['obfs'] = data_get($protocol_settings, 'network_settings.header.type'); - $config['path'] = \Arr::ra(data_get($protocol_settings, 'network_settings.header.request.path', ['/'])); + $config['path'] = \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', ['/'])); break; case 'ws': $config['obfs'] = "websocket"; From 6d46ecb757ac6b05ebcd6723300983bfc2e6ac51 Mon Sep 17 00:00:00 2001 From: NekoCareLab <194696930+NekoCareLab@users.noreply.github.com> Date: Mon, 13 Jan 2025 23:26:29 +0800 Subject: [PATCH 2/2] Protocol Shadowrocket: fixed Vmess + TCP multiple bugs --- app/Protocols/Shadowrocket.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/app/Protocols/Shadowrocket.php b/app/Protocols/Shadowrocket.php index e5cf69b..eeb1e1d 100644 --- a/app/Protocols/Shadowrocket.php +++ b/app/Protocols/Shadowrocket.php @@ -96,8 +96,11 @@ class Shadowrocket implements ProtocolInterface switch (data_get($protocol_settings, 'network')) { case 'tcp': - $config['obfs'] = data_get($protocol_settings, 'network_settings.header.type'); - $config['path'] = \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', ['/'])); + if (data_get($protocol_settings, 'network_settings.header.type', 'none') !== 'none') { + $config['obfs'] = data_get($protocol_settings, 'network_settings.header.type'); + $config['path'] = \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', ['/'])); + $config['obfsParam'] = \Arr::random(data_get($protocol_settings, 'network_settings.header.request.headers.Host', ['www.example.com'])); + } break; case 'ws': $config['obfs'] = "websocket"; @@ -161,13 +164,18 @@ class Shadowrocket implements ProtocolInterface } switch (data_get($protocol_settings, 'network')) { case 'tcp': - $config['obfs'] = data_get($protocol_settings, 'network_settings.header.type'); - $config['path'] = \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', ['/'])); - $config['obfsParam'] = \Arr::random(data_get($protocol_settings, 'network_settings.header.request.headers.Host', ['/'])); + if (data_get($protocol_settings, 'network_settings.header.type', 'none') !== 'none') { + $config['obfs'] = data_get($protocol_settings, 'network_settings.header.type'); + $config['path'] = \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', ['/'])); + $config['obfsParam'] = \Arr::random(data_get($protocol_settings, 'network_settings.header.request.headers.Host', ['www.example.com'])); + } break; case 'ws': $config['obfs'] = "websocket"; - $config['path'] = data_get($protocol_settings, 'network_settings.path'); + if (data_get($protocol_settings, 'network_settings.path')) { + $config['path'] = data_get($protocol_settings, 'network_settings.path'); + } + if ($host = data_get($protocol_settings, 'network_settings.headers.Host')) { $config['obfsParam'] = $host; }