完善VLESS对接和部分客户端订阅链接

This commit is contained in:
root
2023-08-14 00:14:25 +09:00
parent 24205f60f5
commit 437dbffe11
7 changed files with 217 additions and 1 deletions

View File

@ -44,6 +44,10 @@ class ClashMeta
array_push($proxy, self::buildVmess($user['uuid'], $item));
array_push($proxies, $item['name']);
}
if ($item['type'] === 'vless') {
array_push($proxy, self::buildVless($user['uuid'], $item));
array_push($proxies, $item['name']);
}
if ($item['type'] === 'trojan') {
array_push($proxy, self::buildTrojan($user['uuid'], $item));
array_push($proxies, $item['name']);
@ -160,6 +164,34 @@ class ClashMeta
return $array;
}
public static function buildVless($uuid, $server)
{
$array = [];
$array['name'] = $server['name'];
$array['type'] = 'vless';
$array['server'] = $server['host'];
$array['port'] = $server['port'];
$array['uuid'] = $uuid;
$array['flow'] = $server['flow'];
$array['client-fingerprint'] = 'chrome';
$array['udp'] = true;
if ($server['tls']) {
$array['tls'] = true;
if ($server['tls_settings']) {
$tlsSettings = $server['tls_settings'];
if (isset($tlsSettings['server_name']) && !empty($tlsSettings['server_name']))
$array['servername'] = $tlsSettings['server_name'];
}
}
if ($server['network'] === 'tcp') {
$tcpSettings = $server['network_settings'];
}
//ws和grpc需要继续修
return $array;
}
public static function buildTrojan($password, $server)
{
$array = [];