Skip to content

Commit

Permalink
更新配置页面显示更多配置信息
Browse files Browse the repository at this point in the history
  • Loading branch information
cmliu committed Sep 3, 2024
1 parent f1ac6b0 commit dad3f77
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 62 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/package-worker.yml

This file was deleted.

43 changes: 23 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,28 @@
- 快速部署视频教程:https://www.youtube.com/watch?v=59THrmJhmAw ***最佳推荐!!!***
- 进阶使用视频教程:https://www.youtube.com/watch?v=s91zjpw3-P8

Telegram交流群:[@CMLiussss](https://t.me/CMLiussss)**感谢[Alice Networks](https://alice.ws/aff.php?aff=15)提供的云服务器维持[CM订阅转换服务](https://sub.fxxk.dedyn.io/)**
Telegram交流群:[@CMLiussss](https://t.me/CMLiussss)**感谢[Alice Networks](https://url.cmliussss.com/alice)提供的云服务器维持[CM订阅转换服务](https://sub.fxxk.dedyn.io/)**

# 免责声明

本免责声明适用于 GitHub 上的 “edgetunnel” 项目(以下简称“该项目”),项目链接为:https://github.com/cmliu/edgetunnel
本免责声明适用于 GitHub 上的 “edgetunnel” 项目(以下简称“本项目”),项目链接为:https://github.com/cmliu/edgetunnel

### 用途
该项目被设计和开发仅供学习、研究和安全测试目的。它旨在为安全研究者、学术界人士和技术爱好者提供一个了解和实践网络通信技术的工具
本项目仅供教育、研究和安全测试目的而设计和开发。旨在为安全研究人员、学术界人士及技术爱好者提供一个探索和实践网络通信技术的工具

### 合法性
使用者在下载和使用该项目时,必须遵守当地法律和规定。使用者有责任确保他们的行为符合其所在地区的法律、规章以及其他适用的规定
在下载和使用本项目代码时,必须遵守使用者所适用的法律和规定。使用者有责任确保其行为符合所在地区的法律框架、规章制度及其他相关规定

### 免责
1. 作为该项目的作者,我(以下简称“作者”)强调该项目应仅用于合法、道德和教育目的。
2. 作者不鼓励、不支持也不促进任何形式的非法使用该项目。如果发现该项目被用于非法或不道德的活动,作者将强烈谴责这种行为
3. 作者对任何人或团体使用该项目进行的任何非法活动不承担责任。使用者使用该项目时产生的任何后果由使用者本人承担
4. 作者不对使用该项目可能引起的任何直接或间接损害负责
5. 通过使用该项目,使用者表示理解并同意本免责声明的所有条款。如果使用者不同意这些条款,应立即停止使用该项目
1. 作为本项目的 **二次开发作者**(以下简称“作者”),我 **cmliu** 强调本项目仅应用于合法、道德和教育目的。
2. 作者不认可、不支持亦不鼓励任何形式的非法使用。如果发现本项目被用于任何非法或不道德的活动,作者将对此强烈谴责
3. 作者对任何人或组织利用本项目代码从事的任何非法活动不承担责任。使用本项目代码所产生的任何后果,均由使用者自行承担
4. 作者不对使用本项目代码可能引起的任何直接或间接损害负责
5. 为避免任何意外后果或法律风险,使用者应在使用本项目代码后的 24 小时内删除代码

作者保留随时更新本免责声明的权利,且不另行通知。最新的免责声明版本将会在该项目的 GitHub 页面上发布。
通过使用本项目代码,使用者即表示理解并同意本免责声明的所有条款。如使用者不同意这些条款,应立即停止使用本项目。

作者保留随时更新本免责声明的权利,且不另行通知。最新版本的免责声明将发布在本项目的 GitHub 页面上。

## 风险提示
- 通过提交虚假的节点配置给订阅服务,避免节点配置信息泄露。
Expand Down Expand Up @@ -60,11 +62,11 @@ Telegram交流群:[@CMLiussss](https://t.me/CMLiussss),**感谢[Alice Networ

## Pages 上传 部署方法 **最佳推荐!!!** [视频教程](https://www.youtube.com/watch?v=59THrmJhmAw)
1. 部署 CF Pages:
- 下载 [worker.zip](https://raw.githubusercontent.com/cmliu/edgetunnel/main/worker.zip) 文件,并点上 Star !!!
- 在 CF Pages 控制台中选择 `上传资产`后,为你的项目取名后点击 `创建项目`,然后上传你下载好的 [worker.zip](https://raw.githubusercontent.com/cmliu/edgetunnel/main/worker.zip) 文件后点击 `部署站点`
- 下载 [main.zip](https://github.com/cmliu/edgetunnel/archive/refs/heads/main.zip) 文件,并点上 Star !!!
- 在 CF Pages 控制台中选择 `上传资产`后,为你的项目取名后点击 `创建项目`,然后上传你下载好的 [main.zip](https://github.com/cmliu/edgetunnel/archive/refs/heads/main.zip) 文件后点击 `部署站点`
- 部署完成后点击 `继续处理站点` 后,选择 `设置` > `环境变量` > **制作**为生产环境定义变量 > `添加变量`
变量名称填写**UUID**,值则为你的UUID,后点击 `保存`即可。
- 返回 `部署` 选项卡,在右下角点击 `创建新部署` 后,重新上传 [worker.zip](https://raw.githubusercontent.com/cmliu/edgetunnel/main/worker.zip) 文件后点击 `保存并部署` 即可。
- 返回 `部署` 选项卡,在右下角点击 `创建新部署` 后,重新上传 [main.zip](https://github.com/cmliu/edgetunnel/archive/refs/heads/main.zip) 文件后点击 `保存并部署` 即可。

2. 访问订阅内容:
- 访问 `https://[YOUR-PAGES-URL]/[YOUR-UUID]` 即可获取订阅内容。
Expand Down Expand Up @@ -133,11 +135,12 @@ Telegram交流群:[@CMLiussss](https://t.me/CMLiussss),**感谢[Alice Networ
| 变量名 | 示例 | 必填 | 备注 | YT |
|--------|---------|-|-----|-----|
| UUID | `90cd4a77-141a-43c9-991b-08263cfe9c10` || Powershell -NoExit -Command "[guid]::NewGuid()"| [Video](https://www.youtube.com/watch?v=s91zjpw3-P8&t=72s) |
| PROXYIP | `proxyip.fxxk.dedyn.io` || 备选作为访问CFCDN站点的代理节点(支持多ProxyIP, ProxyIP之间使用`,`或 换行 作间隔) | [Video](https://www.youtube.com/watch?v=s91zjpw3-P8&t=166s) |
| SOCKS5 | `user:[email protected]:1080` || 优先作为访问CFCDN站点的SOCKS5代理(支持多socks5, socks5之间使用`,`或 换行 作间隔) | [Video](https://www.youtube.com/watch?v=s91zjpw3-P8&t=826s) |
| ADD | `icook.tw:2053#官方优选域名` || 本地优选TLS域名/优选IP(支持多元素之间`,`或 换行 作间隔) ||
| PROXYIP | `proxyip.fxxk.dedyn.io` || 备选作为访问CFCDN站点的代理节点(支持多ProxyIP, ProxyIP之间使用`,``换行`作间隔) | [Video](https://www.youtube.com/watch?v=s91zjpw3-P8&t=166s) |
| SOCKS5 | `user:[email protected]:1080` || 优先作为访问CFCDN站点的SOCKS5代理(支持多socks5, socks5之间使用`,``换行`作间隔) | [Video](https://www.youtube.com/watch?v=s91zjpw3-P8&t=826s) |
| GO2SOCKS5 | `blog.cmliussss.com`,`*ip111.cn` || 设置`SOCKS5`变量之后,可设置强制使用socks5访问名单(`*`可作为通配符,`换行`作多元素间隔) ||
| ADD | `icook.tw:2053#官方优选域名` || 本地优选TLS域名/优选IP(支持多元素之间`,``换行`作间隔) ||
| ADDAPI | [https://raw.github.../addressesapi.txt](https://raw.githubusercontent.com/cmliu/WorkerVless2sub/main/addressesapi.txt) || 优选IP的API地址(支持多元素之间`,`或 换行 作间隔) ||
| ADDNOTLS | `icook.hk:8080#官方优选域名` || 本地优选noTLS域名/优选IP(支持多元素之间`,` 换行 作间隔) ||
| ADDNOTLS | `icook.hk:8080#官方优选域名` || 本地优选noTLS域名/优选IP(支持多元素之间`,``换行`作间隔) ||
| ADDNOTLSAPI | [https://raw.github.../addressesapi.txt](https://raw.githubusercontent.com/cmliu/CFcdnVmess2sub/main/addressesapi.txt) || 优选IP的API地址(支持多元素之间`,`或 换行 作间隔) ||
| ADDCSV | [https://raw.github.../addressescsv.csv](https://raw.githubusercontent.com/cmliu/WorkerVless2sub/main/addressescsv.csv) || iptest测速结果(支持多元素, 元素之间使用`,`作间隔) ||
| DLS | `8` || `ADDCSV`测速结果满足速度下限 ||
Expand All @@ -148,8 +151,8 @@ Telegram交流群:[@CMLiussss](https://t.me/CMLiussss),**感谢[Alice Networ
| SUBCONFIG | [https://raw.github.../ACL4SSR_Online_Full_MultiMode.ini](https://raw.githubusercontent.com/cmliu/ACL4SSR/main/Clash/config/ACL4SSR_Online_Full_MultiMode.ini) || clash、singbox等 订阅转换配置文件 | [Video](https://www.youtube.com/watch?v=s91zjpw3-P8&t=1605s) |
| SUBNAME | `edgetunnel` || 订阅名称 | |
| RPROXYIP | `false` || 设为 true 即可强制获取订阅器分配的ProxyIP(需订阅器支持)| [Video](https://www.youtube.com/watch?v=s91zjpw3-P8&t=1816s) |
| URL302 | `https://t.me/CMLiussss` || 主页302跳转(支持多url, url之间使用`,` 换行 作间隔, 小白别用) | |
| URL | `https://t.me/CMLiussss` || 主页伪装(支持多url, url之间使用`,` 换行 作间隔, 乱设容易触发反诈) | |
| URL302 | `https://t.me/CMLiussss` || 主页302跳转(支持多url, url之间使用`,``换行`作间隔, 小白别用) | |
| URL | `https://t.me/CMLiussss` || 主页伪装(支持多url, url之间使用`,``换行`作间隔, 乱设容易触发反诈) | |
| CFEMAIL | `[email protected]` || CF账户邮箱(与`CFKEY`都填上后, 订阅信息将显示请求使用量, 小白别用) | |
| CFKEY | `c6a944b5c956b6c18c2352880952bced8b85e` || CF账户Global API Key(与`CFEMAIL`都填上后, 订阅信息将显示请求使用量, 小白别用) | |

Expand Down Expand Up @@ -200,4 +203,4 @@ Telegram交流群:[@CMLiussss](https://t.me/CMLiussss),**感谢[Alice Networ


# 感谢
[zizifn](https://github.com/zizifn/edgetunnel)、[3Kmfi6HP](https://github.com/3Kmfi6HP/EDtunnel)、[Stanley-baby](https://github.com/Stanley-baby)、[ACL4SSR](https://github.com/ACL4SSR/ACL4SSR/tree/master/Clash/config)、[SHIJS1999](https://github.com/SHIJS1999/cloudflare-worker-vless-ip)、<a href="https://alice.ws/aff.php?aff=15"><img src="https://alicenetworks.net/templates/lagom2/assets/img/logo/logo_big.194980063.png" width="150" height="75" alt="Alice Networks LTD"/></a>、
[zizifn](https://github.com/zizifn/edgetunnel)、[3Kmfi6HP](https://github.com/3Kmfi6HP/EDtunnel)、[Stanley-baby](https://github.com/Stanley-baby)、[ACL4SSR](https://github.com/ACL4SSR/ACL4SSR/tree/master/Clash/config)、[SHIJS1999](https://github.com/SHIJS1999/cloudflare-worker-vless-ip)、<a href="https://url.cmliussss.com/alice"><img src="https://alicenetworks.net/templates/lagom2/assets/img/logo/logo_big.194980063.png" width="150" height="75" alt="Alice Networks LTD"/></a>、
73 changes: 57 additions & 16 deletions _worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ let noTLS = 'false';
const expire = 4102329600;//2099-12-31
let proxyIPs;
let socks5s;
let go2Socks5s = [];
let addresses = [];
let addressesapi = [];
let addressesnotls = [];
Expand Down Expand Up @@ -62,7 +63,7 @@ export default {
const fakeUserIDMD5 = await MD5MD5(`${userID}${timestamp}`);
fakeUserID = fakeUserIDMD5.slice(0, 8) + "-" + fakeUserIDMD5.slice(8, 12) + "-" + fakeUserIDMD5.slice(12, 16) + "-" + fakeUserIDMD5.slice(16, 20) + "-" + fakeUserIDMD5.slice(20);
fakeHostName = fakeUserIDMD5.slice(6, 9) + "." + fakeUserIDMD5.slice(13, 19);
console.log(`虚假UUID: ${fakeUserID}`); // 打印fakeID
//console.log(`虚假UUID: ${fakeUserID}`); // 打印fakeID

proxyIP = env.PROXYIP || proxyIP;
proxyIPs = await ADD(proxyIP);
Expand Down Expand Up @@ -105,6 +106,13 @@ export default {
DLS = env.DLS || DLS;
BotToken = env.TGTOKEN || BotToken;
ChatID = env.TGID || ChatID;
if( env.GO2SOCKS5 ) {
const go2Socks5 = env.GO2SOCKS5;
var addGo2Socks5 = go2Socks5.replace(/[\r\n]+/g, '\n').replace(/,+/g, '\n');
if (addGo2Socks5.charAt(0) == '\n') addGo2Socks5 = addGo2Socks5.slice(1);
if (addGo2Socks5.charAt(addGo2Socks5.length - 1) == '\n') addGo2Socks5 = addGo2Socks5.slice(0, addGo2Socks5.length - 1);
go2Socks5s = addGo2Socks5.split('\n');
}
const upgradeHeader = request.headers.get('Upgrade');
const url = new URL(request.url);
if (url.searchParams.has('sub') && url.searchParams.get('sub') !== '') sub = url.searchParams.get('sub');
Expand Down Expand Up @@ -345,6 +353,14 @@ async function vlessOverWSHandler(request) {
* @returns {Promise<void>} 异步操作的 Promise
*/
async function handleTCPOutBound(remoteSocket, addressType, addressRemote, portRemote, rawClientData, webSocket, vlessResponseHeader, log,) {
async function useSocks5Pattern(address) {
if ( go2Socks5s.includes(atob('YWxsIGlu')) ) return true;
return go2Socks5s.some(pattern => {
let regexPattern = pattern.replace(/\*/g, '.*');
let regex = new RegExp(`^${regexPattern}$`, 'i');
return regex.test(address);
});
}
/**
* 连接远程服务器并写入数据
* @param {string} address 要连接的地址
Expand Down Expand Up @@ -394,8 +410,10 @@ async function handleTCPOutBound(remoteSocket, addressType, addressRemote, portR
remoteSocketToWS(tcpSocket, webSocket, vlessResponseHeader, null, log);
}

let useSocks = false;
if( go2Socks5s.length > 0 && enableSocks ) useSocks = await useSocks5Pattern(addressRemote);
// 首次尝试连接远程服务器
let tcpSocket = await connectAndWrite(addressRemote, portRemote);
let tcpSocket = await connectAndWrite(addressRemote, portRemote, useSocks);

// 当远程 Socket 就绪时,将其传递给 WebSocket
// 建立从远程服务器到 WebSocket 的数据流,用于将远程服务器的响应发送回客户端
Expand Down Expand Up @@ -1164,7 +1182,7 @@ const 啥啥啥_写的这是啥啊 = 'dmxlc3M=';
function 配置信息(UUID, 域名地址) {
const 协议类型 = atob(啥啥啥_写的这是啥啊);

const 别名 = 域名地址;
const 别名 = FileName;
let 地址 = 域名地址;
let 端口 = 443;

Expand All @@ -1180,14 +1198,14 @@ function 配置信息(UUID, 域名地址) {
const 指纹 = 'randomized';

if (域名地址.includes('.workers.dev')){
地址 = 'www.wto.org';
地址 = 'visa.cn';
端口 = 80 ;
传输层安全 = ['',false];
}

const v2ray = `${协议类型}://${用户ID}@${地址}:${端口}?encryption=${加密方式}&security=${传输层安全[0]}&sni=${SNI}&fp=${指纹}&type=${传输层协议}&host=${伪装域名}&path=${encodeURIComponent(路径)}#${encodeURIComponent(别名)}`;
const clash = `- type: ${协议类型}
name: ${别名}
name: ${FileName}
server: ${地址}
port: ${端口}
uuid: ${用户ID}
Expand Down Expand Up @@ -1242,26 +1260,37 @@ async function getVLESSConfig(userID, hostName, sub, UA, RproxyIP, _url) {
}

if ( userAgent.includes('mozilla') && !subParams.some(_searchParams => _url.searchParams.has(_searchParams))) {
let 订阅器 = `您的订阅内容由 ${sub} 提供维护支持, 自动获取ProxyIP: ${RproxyIP}`;
const newSocks5s = socks5s.map(socks5Address => {
if (socks5Address.includes('@')) return socks5Address.split('@')[1];
else if (socks5Address.includes('//')) return socks5Address.split('//')[1];
else return socks5Address;
});

let socks5List = '';
if( go2Socks5s.length > 0 && enableSocks ) socks5List = `SOCKS5(白名单): \n ${go2Socks5s.join('\n ')}\n`

let 订阅器 = '';
if (!sub || sub == '') {
if (!proxyIP || proxyIP =='') {
if (enableSocks) 订阅器 += `您的订阅内容由 内置 addresses/ADD 参数提供, 当前使用的Socks5: ${newSocks5s.join(', ')}`;
else 订阅器 = '您的订阅内容由 内置 addresses/ADD 参数提供, 当前使用的ProxyIP为空, 推荐您设置 proxyIP/PROXYIP !!!';
} else {
订阅器 = `您的订阅内容由 内置 addresses/ADD 参数提供, 当前使用的ProxyIP: ${proxyIPs.join(', ')}`;
}
} else if (RproxyIP != 'true'){
if (enableSocks) 订阅器 += `, 当前使用的Socks5: ${newSocks5s.join(', ')}`;
else 订阅器 += `, 当前使用的ProxyIP: ${proxyIPs.join(', ')}`;
if (enableSocks) 订阅器 += `CFCDN(访问方式): Socks5\n ${newSocks5s.join('\n ')}\n${socks5List}`;
else if (!proxyIP || proxyIP =='') 订阅器 += `CFCDN(访问方式): ProxyIP\n ${proxyIPs.join('\n ')}\n`;
else 订阅器 += `CFCDN(访问方式): 无法访问, 需要您设置 proxyIP/PROXYIP !!!\n`;
订阅器 += `\n您的订阅内容由 内置 addresses/ADD* 参数变量提供\n`;
if (addresses.length > 0) 订阅器 += `ADD(TLS优选域名&IP): \n ${addresses.join('\n ')}\n`;
if (addressesnotls.length > 0) 订阅器 += `ADDNOTLS(noTLS优选域名&IP): \n ${addressesnotls.join('\n ')}\n`;
if (addressesapi.length > 0) 订阅器 += `ADDAPI(TLS优选域名&IP 的 API): \n ${addressesapi.join('\n ')}\n`;
if (addressesnotlsapi.length > 0) 订阅器 += `ADDNOTLSAPI(noTLS优选域名&IP 的 API): \n ${addressesnotlsapi.join('\n ')}\n`;
if (addressescsv.length > 0) 订阅器 += `ADDCSV(IPTest测速csv文件 限速 ${DLS} ): \n ${addressescsv.join('\n ')}\n`;
} else {
if (enableSocks) 订阅器 += `CFCDN(访问方式): Socks5\n ${newSocks5s.join('\n ')}\n${socks5List}`;
else if (!proxyIP || proxyIP =='') 订阅器 += `CFCDN(访问方式): ProxyIP\n ${proxyIPs.join('\n ')}\n`;
else if (RproxyIP == 'true') 订阅器 += `CFCDN(访问方式): 自动获取ProxyIP\n`;
else 订阅器 += `CFCDN(访问方式): 无法访问, 需要您设置 proxyIP/PROXYIP !!!\n`
订阅器 += `\nSUB(优选订阅生成器): ${sub}`;
}

return `
################################################################
Subscribe / sub 订阅地址, 支持 Base64、clash-meta、sing-box 订阅格式, ${订阅器}
Subscribe / sub 订阅地址, 支持 Base64、clash-meta、sing-box 订阅格式
---------------------------------------------------------------
快速自适应订阅地址:
https://${proxyhost}${hostName}/${userID}
Expand All @@ -1279,6 +1308,18 @@ https://${proxyhost}${hostName}/${userID}?sb
https://${proxyhost}${hostName}/${userID}?singbox
---------------------------------------------------------------
################################################################
${FileName} 配置信息
---------------------------------------------------------------
HOST: ${hostName}
UUID: ${userID}
FKID: ${fakeUserID}
UA: ${UA}
${订阅器}
SUBAPI(订阅转换后端): ${subProtocol}://${subconverter}
SUBCONFIG(订阅转换配置文件): ${subconfig}
---------------------------------------------------------------
################################################################
v2ray
---------------------------------------------------------------
${v2ray}
Expand Down
Binary file removed worker.zip
Binary file not shown.

0 comments on commit dad3f77

Please sign in to comment.