MCPcopy Create free account
hub / github.com/Ptechgithub/configs / getVLESSConfig

Function getVLESSConfig

worker.js:717–824  ·  view source on GitHub ↗

* * @param {string} userID - single or comma separated userIDs * @param {string | null} hostName * @returns {string}

(userIDs, hostName)

Source from the content-addressed store, hash-verified

715 * @returns {string}
716 */
717function getVLESSConfig(userIDs, hostName) {
718 const commonUrlPart = `:443?encryption=none&security=tls&sni=${hostName}&fp=randomized&type=ws&host=${hostName}&path=%2F%3Fed%3D2048#${hostName}`;
719 const separator = "---------------------------------------------------------------";
720 const hashSeparator = "################################################################";
721
722 // Split the userIDs into an array
723 let userIDArray = userIDs.split(',');
724
725 // Prepare output array
726 let output = [];
727 let header = [];
728 const clash_link = `https://subconverter.do.xn--b6gac.eu.org/sub?target=clash&url=https://${hostName}/sub/${userIDArray[0]}?format=clash&insert=false&emoji=true&list=false&tfo=false&scv=true&fdn=false&sort=false&new_name=true`;
729 header.push(`\n<p align="center"><img src="https://cloudflare-ipfs.com/ipfs/bafybeigd6i5aavwpr6wvnwuyayklq3omonggta4x2q7kpmgafj357nkcky" alt="图片描述" style="margin-bottom: -50px;">`);
730 header.push(`\n<b style=" font-size: 15px;" >Welcome! This function generates configuration for VLESS protocol. If you found this useful, please check our GitHub project for more:</b>\n`);
731 header.push(`<b style=" font-size: 15px;" >欢迎!这是生成 VLESS 协议的配置。如果您发现这个项目很好用,请查看我们的 GitHub 项目给我一个star:</b>\n`);
732 header.push(`\n<a href="https://github.com/3Kmfi6HP/EDtunnel" target="_blank">EDtunnel - https://github.com/3Kmfi6HP/EDtunnel</a>\n`);
733 header.push(`\n<iframe src="https://ghbtns.com/github-btn.html?user=USERNAME&repo=REPOSITORY&type=star&count=true&size=large" frameborder="0" scrolling="0" width="170" height="30" title="GitHub"></iframe>\n\n`.replace(/USERNAME/g, "3Kmfi6HP").replace(/REPOSITORY/g, "EDtunnel"));
734 header.push(`<a href="//${hostName}/sub/${userIDArray[0]}" target="_blank">VLESS 节点订阅连接</a>\n<a href="clash://install-config?url=${encodeURIComponent(clash_link)}" target="_blank">Clash 节点订阅连接</a>\n<a href="${clash_link}" target="_blank">Clash 节点订阅连接2</a></p>\n`);
735 header.push(``);
736
737 // Generate output string for each userID
738 userIDArray.forEach((userID) => {
739 const vlessMain = `vless://${userID}@${hostName}${commonUrlPart}`;
740 const vlessSec = `vless://${userID}@${proxyIP}${commonUrlPart}`;
741 output.push(`UUID: ${userID}`);
742 output.push(`${hashSeparator}\nv2ray default ip\n${separator}\n${vlessMain}\n${separator}`);
743 output.push(`${hashSeparator}\nv2ray with best ip\n${separator}\n${vlessSec}\n${separator}`);
744 });
745 output.push(`${hashSeparator}\n# Clash Proxy Provider 配置格式(configuration format)\nproxy-groups:\n - name: UseProvider\n type: select\n use:\n - provider1\n proxies:\n - Proxy\n - DIRECT\nproxy-providers:\n provider1:\n type: http\n url: https://${hostName}/sub/${userIDArray[0]}?format=clash\n interval: 3600\n path: ./provider1.yaml\n health-check:\n enable: true\n interval: 600\n # lazy: true\n url: http://www.gstatic.com/generate_204\n\n${hashSeparator}`);
746
747 // HTML Head with CSS
748 const htmlHead = `
749 <head>
750 <title>EDtunnel: VLESS configuration</title>
751 <meta name="description" content="This is a tool for generating VLESS protocol configurations. Give us a star on GitHub https://github.com/3Kmfi6HP/EDtunnel if you found it useful!">
752 <meta name="keywords" content="EDtunnel, cloudflare pages, cloudflare worker, severless">
753 <meta name="viewport" content="width=device-width, initial-scale=1">
754 <meta property="og:site_name" content="EDtunnel: VLESS configuration" />
755 <meta property="og:type" content="website" />
756 <meta property="og:title" content="EDtunnel - VLESS configuration and subscribe output" />
757 <meta property="og:description" content="Use cloudflare pages and worker severless to implement vless protocol" />
758 <meta property="og:url" content="https://${hostName}/" />
759 <meta property="og:image" content="https://api.qrserver.com/v1/create-qr-code/?size=500x500&data=${encodeURIComponent(`vless://${userIDs.split(',')[0]}@${hostName}${commonUrlPart}`)}" />
760 <meta name="twitter:card" content="summary_large_image" />
761 <meta name="twitter:title" content="EDtunnel - VLESS configuration and subscribe output" />
762 <meta name="twitter:description" content="Use cloudflare pages and worker severless to implement vless protocol" />
763 <meta name="twitter:url" content="https://${hostName}/" />
764 <meta name="twitter:image" content="https://cloudflare-ipfs.com/ipfs/bafybeigd6i5aavwpr6wvnwuyayklq3omonggta4x2q7kpmgafj357nkcky" />
765 <meta property="og:image:width" content="1500" />
766 <meta property="og:image:height" content="1500" />
767
768 <style>
769 body {
770 font-family: Arial, sans-serif;
771 background-color: #f0f0f0;
772 color: #333;
773 padding: 10px;
774 }

Callers 1

fetchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected