From 3f986992e5a4f70e80a2cf630895a2fb71bec7d3 Mon Sep 17 00:00:00 2001 From: betaxab Date: Fri, 19 May 2023 09:36:10 +0800 Subject: [PATCH] Client: Loon: add TCP-HTTP support, set cipher to auto --- app/Http/Controllers/Client/Protocols/Loon.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Client/Protocols/Loon.php b/app/Http/Controllers/Client/Protocols/Loon.php index 70014701..994bf38b 100644 --- a/app/Http/Controllers/Client/Protocols/Loon.php +++ b/app/Http/Controllers/Client/Protocols/Loon.php @@ -69,7 +69,7 @@ class Loon "{$server['name']}=vmess", "{$server['host']}", "{$server['port']}", - 'aes-128-gcm', + 'auto', "{$uuid}", 'fast-open=false', 'udp=true', @@ -78,6 +78,15 @@ class Loon if ($server['network'] === 'tcp') { array_push($config, 'transport=tcp'); + if ($server['networkSettings']) { + $tcpSettings = $server['networkSettings']; + if (isset($tcpSettings['header']['type']) && !empty($tcpSettings['header']['type'])) + $config = str_replace('transport=tcp', "transport={$tcpSettings['header']['type']}", $config); + if (isset($tcpSettings['header']['request']['path'][0]) && !empty($tcpSettings['header']['request']['path'][0])) + array_push($config, "path={$tcpSettings['header']['request']['path'][0]}"); + if (isset($tcpSettings['header']['Host']) && !empty($tcpSettings['header']['Host'])) + array_push($config, "host={$tcpSettings['header']['Host']}"); + } } if ($server['tls']) { if ($server['network'] === 'tcp')