Skip to content

Commit

Permalink
Client: Loon: add TCP-HTTP support, set cipher to auto
Browse files Browse the repository at this point in the history
  • Loading branch information
betaxab committed May 19, 2023
1 parent d6f35d0 commit 3f98699
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/Http/Controllers/Client/Protocols/Loon.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static function buildVmess($uuid, $server)
"{$server['name']}=vmess",
"{$server['host']}",
"{$server['port']}",
'aes-128-gcm',
'auto',
"{$uuid}",
'fast-open=false',
'udp=true',
Expand All @@ -78,6 +78,15 @@ public static function buildVmess($uuid, $server)

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')
Expand Down

0 comments on commit 3f98699

Please sign in to comment.