", "~", "+", "=", ",", "." )); } $charsLen = count($chars) - 1; shuffle($chars); $str = ''; for($i=0; $i<$len; $i++){ $str .= $chars[mt_rand(0, $charsLen)]; } return $str; } public static function buildVmessLink($item, $user) { $config = [ "ps" => $item->name, "add" => $item->host, "port" => $item->port, "id" => $user->v2ray_uuid, "aid" => "2", "net" => $item->network, "type" => "chacha20-poly1305", "host" => "", "tls" => $item->tls?"tls":"", ]; if ($item->network == 'ws') { $wsSettings = json_decode($item->settings); if ($wsSettings->path) $config['path'] = $wsSettings->path; if ($wsSettings->headers->Host) $config['host'] = $wsSettings->headers->Host; } return "vmess://".base64_encode(json_encode($config))."\r\n"; } }