Skip to content

Commit

Permalink
Merge pull request #832 from betaxab/loon-p1
Browse files Browse the repository at this point in the history
Client: Loon: add TCP-HTTP support, set cipher to auto
  • Loading branch information
tokumeikoi committed May 22, 2023
2 parents 4dc6d29 + 3f98699 commit 74c025e
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 74c025e

Please sign in to comment.