Skip to content

Commit 6fb9ab0

Browse files
committed
fix: 更新订阅请求处理逻辑,支持从环境变量获取ECH_DOH配置
1 parent f7e7b43 commit 6fb9ab0

2 files changed

Lines changed: 80 additions & 57 deletions

File tree

README.md

Lines changed: 79 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
# 🚀 edgetunnel 2.0
22
![后台页面](./img.png)
33

4-
- **Edgetunnel 图文教程**https://cmliussss.com/p/edt2 ***必看内容!必看内容!必看内容!!!***
5-
- **报错 Error 1101 详解**https://www.youtube.com/watch?v=r4uVTEJptdE
4+
[![Stars](https://img.shields.io/github/stars/cmliu/edgetunnel?style=flat-square&logo=github)](https://github.com/cmliu/edgetunnel/stargazers)
5+
[![Forks](https://img.shields.io/github/forks/cmliu/edgetunnel?style=flat-square&logo=github)](https://github.com/cmliu/edgetunnel/network/members)
6+
[![License](https://img.shields.io/github/license/cmliu/edgetunnel?style=flat-square)](https://github.com/cmliu/edgetunnel/blob/main/LICENSE)
7+
[![Telegram](https://img.shields.io/badge/Telegram-Group-blue?style=flat-square&logo=telegram)](https://t.me/CMLiussss)
8+
[![YouTube](https://img.shields.io/badge/YouTube-Channel-red?style=flat-square&logo=youtube)](https://www.youtube.com/watch?v=LeT4jQUh8ok)
9+
[![DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/cmliu/edgetunnel)
10+
---
611

7-
- Telegram交流群:[@CMLiussss](https://t.me/CMLiussss)
12+
## 📖 项目简介
813

9-
## ⚠️ 免责声明
10-
11-
本免责声明适用于 GitHub 上的 “edgetunnel” 项目(以下简称“本项目”),项目链接为:https://github.com/cmliu/edgetunnel
14+
**edgetunnel** 是一个基于 CF Workers/Pages 平台的边缘计算隧道解密方案。它能够高效地处理网络流量,并提供强大的管理面板和灵活的节点配置能力。
1215

13-
### 用途
14-
本项目仅供教育、研究和安全测试目的而设计和开发。旨在为安全研究人员、学术界人士及技术爱好者提供一个探索和实践网络通信技术的工具。
16+
### ✨ 核心特性
1517

16-
### 合法性
17-
在下载和使用本项目代码时,必须遵守使用者所适用的法律和规定。使用者有责任确保其行为符合所在地区的法律框架、规章制度及其他相关规定。
18+
- 🛡️ **协议支持**:支持 VLESS、Trojan 等主流协议,深度集成加密传输。
19+
- 📊 **管理面板**:内置可视化后台,支持实时配置修改、日志查看及流量统计。
20+
- 🛠️ **部署灵活**:完整适配 CF Workers 及 CF Pages (GitHub / 上传)。
21+
- 🔄 **订阅系统**:内置自动订阅生成及混淆转换,适配主流客户端(Clash, Sing-box, Surge 等)。
22+
-**性能加速**:支持自定义 ProxyIP、SOCKS5/HTTP 链式代理及优选 API,优化网络延迟。
23+
- 🌐 **多台适配**:完美适配 Windows, Android, iOS, MacOS 及各种软路由固件。
1824

19-
### 免责
20-
1. 作为本项目的 **二次开发作者**(以下简称“作者”),我 **cmliu** 强调本项目仅应用于合法、道德和教育目的。
21-
2. 作者不认可、不支持亦不鼓励任何形式的非法使用。如果发现本项目被用于任何非法或不道德的活动,作者将对此强烈谴责。
22-
3. 作者对任何人或组织利用本项目代码从事的任何非法活动不承担责任。使用本项目代码所产生的任何后果,均由使用者自行承担。
23-
4. 作者不对使用本项目代码可能引起的任何直接或间接损害负责。
24-
5. 为避免任何意外后果或法律风险,使用者应在使用本项目代码后的 24 小时内删除代码。
25+
---
2526

26-
通过使用本项目代码,使用者即表示理解并同意本免责声明的所有条款。如使用者不同意这些条款,应立即停止使用本项目。
27+
## 💡 快速部署
28+
>[!TIP]
29+
> 📖 **详尽图文教程**[edgetunnel 部署指南](https://cmliussss.com/p/edt2/)
30+
> 🖥️ **Demo 演示站点**[https://EDT-Pages.github.io/admin](https://EDT-Pages.github.io/admin)
2731
28-
作者保留随时更新本免责声明的权利,且不另行通知。最新版本的免责声明将发布在本项目的 GitHub 页面上。
32+
>[!WARNING]
33+
> ⚠️ **Error 1101问题**[视频解析](https://www.youtube.com/watch?v=r4uVTEJptdE)
2934
30-
## 🔥 风险提示
31-
- 通过提交虚假的节点配置给订阅服务,避免节点配置信息泄露。
32-
- 另外,您也可以选择自行部署 [WorkerVless2sub 订阅生成服务](https://github.com/cmliu/WorkerVless2sub),这样既可以利用订阅生成器的便利。
33-
34-
## 💡 如何使用?
35-
### ⚙️ Workers 部署方法
35+
### ⚙️ Workers 部署
3636

3737
<details>
3838
<summary><code><strong>「 Workers 部署文字教程 」</strong></code></summary>
@@ -83,10 +83,10 @@
8383

8484
</details>
8585

86-
### 🛠 Pages GitHub 部署方法
86+
### 🛠 Pages + GitHub 部署方法
8787

8888
<details>
89-
<summary><code><strong>「 Pages GitHub 部署文字教程 」</strong></code></summary>
89+
<summary><code><strong>「 Pages + GitHub 部署文字教程 」</strong></code></summary>
9090

9191
1. 部署 CF Pages:
9292
- 在 Github 上先 Fork 本项目,并点上 Star !!!
@@ -109,21 +109,27 @@
109109

110110
</details>
111111

112-
## 🔑 变量说明
112+
---
113+
114+
## 🔑 环境变量说明
115+
116+
| 变量名 | 必填 | 示例 | 详细备注 |
117+
| :--- | :---: | :--- | :--- |
118+
| **ADMIN** || `123456` | 后台管理面板登录密码 |
119+
| **KEY** || `CMLiussss` | 快速订阅路径密钥,访问 `/CMLiussss` 即可快速获取节点 |
120+
| **UUID** || `90cd4a77-141a-43c9-991b-08263cfe9c10` | 强制固定UUID |
121+
| **HOST** || `edt.pages.dev` | 强制固定伪装域名 |
122+
| **PATH** || `/` | 强制固定伪装路径 |
123+
| **PROXYIP** || `proxyip.cmliussss.net:443` | 全局自定义反代 IP |
124+
| **URL** || `https://cloudflare-error-page-3th.pages.dev` | 默认主页伪装地址(可填写网页 URL 或 `1101`|
125+
| **GO2SOCKS5** || `blog.cmliussss.com`,`*.ip111.cn`,`*google.com` | 强制走 SOCKS5 的名单 (`*` 为全局,域名用逗号分隔) |
126+
| **DOH** || `https://doh.cmliussss.com/CMLiussss` | 用于解析ECH的DoH服务器 |
113127

114-
| 变量名 | 示例 | 必填 | 备注 |
115-
|--------|---------|-|-----|
116-
| ADMIN | `123456` || 面板登录密码 |
117-
| KEY | `CMLiussss` || 快速订阅密钥,访问`/CMLiussss`即可快读订阅。 |
118-
| HOST | `edt-pages.github.io` || 强制固定伪装域名(支持多元素,使用`换行符``,`做间隔) |
119-
| UUID | `90cd4a77-141a-43c9-991b-08263cfe9c10` || 强制固定UUID |
120-
| PATH | `/` || 强制固定路径 |
121-
| PROXYIP | `proxyip.cmliussss.net:443` || 更换默认内置PROXYIP |
122-
| URL | `https://cloudflare-error-page-3th.pages.dev` || 主页反代伪装(乱设容易触发反诈,反代被墙的网站会加速域名被墙) |
123-
| GO2SOCKS5 | `blog.cmliussss.com`,`*.ip111.cn`,`*google.com` || 设置`SOCKS5``HTTP`变量之后,可设置强制使用socks5访问名单(设置为`*`可作为全局代理) |
128+
---
124129

125-
## 🔧 实用技巧
126-
该项目部署的节点可通过节点PATH(路径)的方式,使用指定的`PROXYIP``SOCKS5`!!!
130+
## 🔧 高级实用技巧
131+
132+
本工具支持通过 **PATH路径** 动态切换底层代理方案:
127133

128134
- 指定 `PROXYIP` 案例
129135
```url
@@ -146,24 +152,26 @@
146152
/http://user:password@127.0.0.1:8080 (默认激活全局SOCKS5)
147153
```
148154

149-
## ⭐ Star 星星走起
155+
---
156+
157+
## 💻 客户端适配情况
158+
159+
| 平台 | 推荐客户端 | 备注 |
160+
| :--- | :--- | :--- |
161+
| **Windows** | [v2rayN](https://github.com/2dust/v2rayN), [FlClash](https://github.com/chen08209/FlClash), [mihomo-party](https://github.com/mihomo-party-org/mihomo-party), [Clash Verge Rev](https://github.com/ClashVerge/ClashVerge-Rev) | 全面支持 |
162+
| **Android** | [ClashMetaForAndroid](https://github.com/chen08209/ClashMetaForAndroid), [FlClash](https://github.com/chen08209/FlClash), [v2rayNG](https://github.com/2dust/v2rayNG) | 建议使用 Meta 核心 |
163+
| **iOS** | [Surge](https://surgeapp.com/), [Shadowrocket](https://shadowrocket.com/), [Stash](https://stashapp.com/) | 完美适配 |
164+
| **MacOS** | [FlClash](https://github.com/chen08209/FlClash), [mihomo-party](https://github.com/mihomo-party-org/mihomo-party), [Clash Verge Rev](https://github.com/ClashVerge/ClashVerge-Rev), [Surge](https://surgeapp.com/) | M1/M2 完美兼容 |
165+
166+
---
167+
168+
## ⭐ 项目热度
169+
150170
[![Stargazers over time](https://starchart.cc/cmliu/edgetunnel.svg?variant=adaptive)](https://starchart.cc/cmliu/edgetunnel)
151171

152-
## 💻 已适配客户端
153-
### Windows
154-
- [v2rayN](https://github.com/2dust/v2rayN)
155-
- clash.meta([FlClash](https://github.com/chen08209/FlClash)[mihomo-party](https://github.com/mihomo-party-org/mihomo-party)[clash-verge-rev](https://github.com/clash-verge-rev/clash-verge-rev)[Clash Nyanpasu](https://github.com/keiko233/clash-nyanpasu)
156-
### IOS
157-
- Surge,小火箭
158-
- sing-box([SFI](https://sing-box.sagernet.org/zh/clients/apple/)
159-
### 安卓
160-
- clash.meta([ClashMetaForAndroid](https://github.com/MetaCubeX/ClashMetaForAndroid)[FlClash](https://github.com/chen08209/FlClash)
161-
- sing-box([SFA](https://github.com/SagerNet/sing-box)
162-
### MacOS
163-
- clash.meta([FlClash](https://github.com/chen08209/FlClash)[mihomo-party](https://github.com/mihomo-party-org/mihomo-party)
164-
165-
166-
# 🙏 特别鸣谢
172+
---
173+
174+
## 🙏 特别鸣谢
167175
### 💖 赞助支持 - 提供云服务器维持[订阅转换服务](https://sub.cmliussss.net/)
168176
- [NodeLoc](https://www.nodeloc.com/)
169177
- [Alice](https://url.cmliussss.com/alice)
@@ -180,6 +188,20 @@
180188
- [Workers/Pages Metrics](https://t.me/zhetengsha/3382)
181189
- [白嫖哥](https://t.me/bestcfipas)
182190
- [Mingyu](https://github.com/ymyuuu/workers-vless)
183-
- [Alexandre Kojève](https://t.me/Enkelte_notif/784):stallTCP v1.3
191+
- [Alexandre Kojève](https://t.me/Enkelte_notif/784)
184192
- [eooce](https://github.com/eooce/Cloudflare-proxy)
185-
- [Sukka](https://ip.skk.moe/)
193+
- [Sukka](https://ip.skk.moe/)
194+
195+
---
196+
197+
## ⚠️ 免责声明
198+
199+
1. 本项目("edgetunnel")仅供**教育、科学研究及个人安全测试**之目的。
200+
2. 使用者在下载或使用本项目代码时,必须严格遵守所在地区的法律法规。
201+
3. 作者 **cmliu** 对任何滥用本项目代码导致的行为或后果均不承担任何责任。
202+
4. 本项目不对因使用代码引起的任何直接或间接损害负责。
203+
5. 建议在测试完成后 24 小时内删除本项目相关部署。
204+
205+
---
206+
207+
**如果您觉得项目对您有帮助,请给一个 Star 🌟,这是对我最大的鼓励!**

_worker.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export default {
2424
} else 反代IP = (request.cf.colo + '.PrOxYIp.CmLiUsSsS.nEt').toLowerCase();
2525
const 访问IP = request.headers.get('X-Real-IP') || request.headers.get('CF-Connecting-IP') || request.headers.get('X-Forwarded-For') || request.headers.get('True-Client-IP') || request.headers.get('Fly-Client-IP') || request.headers.get('X-Appengine-Remote-Addr') || request.headers.get('X-Forwarded-For') || request.headers.get('X-Real-IP') || request.headers.get('X-Cluster-Client-IP') || request.cf?.clientTcpRtt || '未知IP';
2626
if (env.GO2SOCKS5) SOCKS5白名单 = await 整理成数组(env.GO2SOCKS5);
27+
ECH_DOH = env.ECH_DOH || env.DOH || ECH_DOH;
2728
if (!upgradeHeader || upgradeHeader !== 'websocket') {
2829
if (url.protocol === 'http:') return Response.redirect(url.href.replace(`http://${url.hostname}`, `https://${url.hostname}`), 301);
2930
if (!管理员密码) return fetch(Pages静态页面 + '/noADMIN').then(r => { const headers = new Headers(r.headers); headers.set('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate'); headers.set('Pragma', 'no-cache'); headers.set('Expires', '0'); return new Response(r.body, { status: 404, statusText: r.statusText, headers }); });

0 commit comments

Comments
 (0)