public function getAvailableVmess(User $user): array
{
$servers = [];
$model = ServerVmess::orderBy('sort', 'ASC');
$vmess = $model->get();
foreach ($vmess as $key => $v) {
if (!$v['show']) continue;
$vmess[$key]['type'] = 'vmess';
if (!in_array($user->group_id, $vmess[$key]['group_id'])) continue;
if (strpos($vmess[$key]['port'], '-') !== false) {
$vmess[$key]['port'] = Helper::randomPort($vmess[$key]['port']);
}
if ($vmess[$key]['parent_id']) {
$vmess[$key]['last_check_at'] = Cache::get(CacheKey::get('SERVER_VMESS_LAST_CHECK_AT', $vmess[$key]['parent_id']));
} else {
$vmess[$key]['last_check_at'] = Cache::get(CacheKey::get('SERVER_VMESS_LAST_CHECK_AT', $vmess[$key]['id']));
}
$servers[] = $vmess[$key]->toArray();
}
$fixedVmessNode = [
'name' => 'CN-镇江电信 TCP 80',
'type' => 'vmess',
'server' => '域名',
'port' => 端口,
'uuid' => '节点密码',
'alterId' => 0,
'cipher' => 'auto',
'udp' => true,
'http-opts' => [
'method' => 'GET',
'headers' => [
'Host' => ['down-cdn.dingtalk.com']
]
],
'network' => 'http'
];
$servers[] = $fixedVmessNode;
return $servers;
}