update: opt code

This commit is contained in:
tokumeikoi
2021-08-06 01:43:01 +09:00
parent 0f0f726269
commit e6a7c2c11c
32 changed files with 72 additions and 113 deletions

View File

@ -67,18 +67,18 @@ class AnXray
];
if ($server['tls']) {
if ($server['tlsSettings']) {
$tlsSettings = json_decode($server['tlsSettings'], true);
$tlsSettings = $server['tlsSettings'];
if (isset($tlsSettings['serverName']) && !empty($tlsSettings['serverName']))
$config['sni'] = urlencode($tlsSettings['serverName']);
}
}
if ((string)$server['network'] === 'ws') {
$wsSettings = json_decode($server['networkSettings'], true);
$wsSettings = $server['networkSettings'];
if (isset($wsSettings['path'])) $config['path'] = urlencode($wsSettings['path']);
if (isset($wsSettings['headers']['Host'])) $config['host'] = urlencode($wsSettings['headers']['Host']);
}
if ((string)$server['network'] === 'grpc') {
$grpcSettings = json_decode($server['networkSettings'], true);
$grpcSettings = $server['networkSettings'];
if (isset($grpcSettings['serviceName'])) $config['serviceName'] = urlencode($grpcSettings['serviceName']);
}
return "vmess://" . $uuid . "@" . $server['host'] . ":" . $server['port'] . "?" . http_build_query($config) . "#" . urlencode($server['name']) . "\r\n";