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 27415c3 commit c05e60a
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 66 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/package-worker.yml

This file was deleted.

39 changes: 21 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,24 @@ Telegram交流群:[@CMLiussss](https://t.me/CMLiussss),**感谢[Alice Networ

# 免责声明

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

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

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

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

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

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

## 风险提示
- 通过提交虚假的节点配置给订阅服务,避免节点配置信息泄露。
Expand All @@ -49,7 +51,7 @@ Telegram交流群:[@CMLiussss](https://t.me/CMLiussss),**感谢[Alice Networ
```
- 或 给 `sub` 添加 **Trojan优选订阅生成器** 地址,例如:
```js
let sub = 'trojan.fxxk.dedyn.io';
let sub = 'Trojan.fxxk.dedyn.io';
```

3. 访问订阅内容:
Expand All @@ -65,11 +67,11 @@ Telegram交流群:[@CMLiussss](https://t.me/CMLiussss),**感谢[Alice Networ

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

2. 添加优选线路:
- 添加变量 `ADD` 本地静态的优选线路,若不带端口号 TLS默认端口为443,#号后为备注别名,例如:
Expand Down Expand Up @@ -138,9 +140,10 @@ Telegram交流群:[@CMLiussss](https://t.me/CMLiussss),**感谢[Alice Networ
| 变量名 | 示例 | 备注 |
|--------|---------|-----|
| PASSWORD | `auto` | 可以取任意值 |
| PROXYIP | `proxyip.fxxk.dedyn.io` | 备选作为访问CFCDN站点的代理节点(支持多ProxyIP, ProxyIP之间使用`,`或 换行 作间隔) |
| SOCKS5 | `user:[email protected]:1080` | 优先作为访问CFCDN站点的SOCKS5代理(支持多socks5, socks5之间使用`,`或 换行 作间隔) |
| ADD | `www.csgo.com:2087,icook.hk` | 本地优选域名/优选IP(支持多元素之间`,`或 换行 作间隔) |
| PROXYIP | `proxyip.fxxk.dedyn.io` | 备选作为访问CFCDN站点的代理节点(支持多ProxyIP, ProxyIP之间使用`,``换行`作间隔) |
| SOCKS5 | `user:[email protected]:1080` | 优先作为访问CFCDN站点的SOCKS5代理(支持多socks5, socks5之间使用`,``换行`作间隔) |
| GO2SOCKS5 | `blog.cmliussss.com`,`*ip111.cn` | 设置`SOCKS5`变量之后,可设置强制使用socks5访问名单(`*`可作为通配符,`换行`作多元素间隔) |
| ADD | `www.csgo.com:2087,icook.hk` | 本地优选域名/优选IP(支持多元素之间`,``换行`作间隔) |
| ADDAPI | [https://raw.github.../addressesapi.txt](https://raw.githubusercontent.com/cmliu/WorkerVless2sub/main/addressesapi.txt) | 不解释, 懂得都懂 |
| ADDCSV | [https://raw.github.../addressescsv.csv](https://raw.githubusercontent.com/cmliu/WorkerVless2sub/main/addressescsv.csv) | 不解释, 懂得都懂 |
| DLS | `8` | `ADDCSV`测速结果满足速度下限 |
Expand All @@ -151,8 +154,8 @@ Telegram交流群:[@CMLiussss](https://t.me/CMLiussss),**感谢[Alice Networ
| SUBCONFIG | [https://raw.github.../ACL4SSR_Online_Mini.ini](https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini.ini) | clash、singbox等 订阅转换配置文件 |
| SUBNAME | `epeius` | 订阅名称 |
| RPROXYIP | `false` | 设为 true 即可强制获取订阅器分配的ProxyIP(需订阅器支持)|
| 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
6 changes: 3 additions & 3 deletions _worker.js

Large diffs are not rendered by default.

73 changes: 56 additions & 17 deletions _worker.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ let fakeUserID ;
let fakeHostName ;
let proxyIPs ;
let socks5s;
let go2Socks5s = [];
let sha224Password ;
const expire = 4102329600;//2099-12-31
const regex = /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|\[.*\]):?(\d+)?#?(.*)?$/;
Expand Down Expand Up @@ -108,6 +109,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 @@ -371,6 +379,14 @@ async function parseTrojanHeader(buffer) {
}

async function handleTCPOutBound(remoteSocket, addressRemote, portRemote, rawClientData, webSocket, log, addressType) {
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);
});
}
async function connectAndWrite(address, port, socks = false) {
log(`connected to ${address}:${port}`);
//if (/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(address)) address = `${atob('d3d3Lg==')}${address}${atob('LmlwLjA5MDIyNy54eXo=')}`;
Expand Down Expand Up @@ -401,7 +417,9 @@ async function handleTCPOutBound(remoteSocket, addressRemote, portRemote, rawCli
});
remoteSocketToWS(tcpSocket2, webSocket, null, log);
}
const tcpSocket = await connectAndWrite(addressRemote, portRemote);
let useSocks = false;
if( go2Socks5s.length > 0 && enableSocks ) useSocks = await useSocks5Pattern(addressRemote);
let tcpSocket = await connectAndWrite(addressRemote, portRemote, useSocks);
remoteSocketToWS(tcpSocket, webSocket, retry, log);
}

Expand Down Expand Up @@ -563,7 +581,7 @@ function 配置信息(密码, 域名地址) {
const 啥啥啥_写的这是啥啊 = 'dHJvamFu';
const 协议类型 = atob(啥啥啥_写的这是啥啊);

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

Expand All @@ -575,9 +593,9 @@ function 配置信息(密码, 域名地址) {
const SNI = 域名地址;
const 指纹 = 'randomized';

const v2ray = `${协议类型}://${encodeURIComponent(密码)}@${地址}:${端口}?security=${传输层安全[0]}&sni=${SNI}&fp=${指纹}&type=${传输层协议}&host=${伪装域名}&path=${encodeURIComponent(路径)}#${encodeURIComponent(别名)}`
const clash = `- {name: ${别名}, server: ${地址}, port: ${端口}, udp: false, client-fingerprint: ${指纹}, type: ${协议类型}, password: ${密码}, sni: ${SNI}, skip-cert-verify: true, network: ${传输层协议}, ws-opts: {path: ${路径}, headers: {Host: ${伪装域名}}}}`;
const v2ray = `${协议类型}://${encodeURIComponent(密码)}@${地址}:${端口}?security=${传输层安全[0]}&sni=${SNI}&alpn=h3&fp=${指纹}&allowInsecure=1&type=${传输层协议}&host=${伪装域名}&path=${encodeURIComponent(路径)}#${encodeURIComponent(别名)}`
const clash = `- {name: ${别名}, server: ${地址}, port: ${端口}, udp: false, client-fingerprint: ${指纹}, type: ${协议类型}, password: ${密码}, sni: ${SNI}, alpn: [h3], skip-cert-verify: true, network: ${传输层协议}, ws-opts: {path: "${路径}", headers: {Host: ${伪装域名}}}}`;

return [v2ray,clash];
}

Expand Down Expand Up @@ -614,27 +632,35 @@ async function getTrojanConfig(password, hostName, sub, UA, RproxyIP, _url) {
if ( userAgent.includes('mozilla') && !subParams.some(_searchParams => _url.searchParams.has(_searchParams))) {
let surge = `Surge订阅地址:\nhttps://${proxyhost}${hostName}/${password}?surge`;
if (hostName.includes(".workers.dev") || hostName.includes(".pages.dev")) surge = "Surge订阅必须绑定自定义域";

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 (addressesapi.length > 0) 订阅器 += `ADDAPI(TLS优选域名&IP 的 API): \n ${addressesapi.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}/${password}
Expand All @@ -654,6 +680,19 @@ https://${proxyhost}${hostName}/${password}?singbox
${surge}
---------------------------------------------------------------
################################################################
${FileName} 配置信息
---------------------------------------------------------------
HOST: ${hostName}
PASSWORD: ${password}
SHA224: ${sha224Password}
FAKEPASS: ${fakeUserID}
UA: ${UA}
${订阅器}
SUBAPI(订阅转换后端): ${subProtocol}://${subconverter}
SUBCONFIG(订阅转换配置文件): ${subconfig}
---------------------------------------------------------------
################################################################
v2ray
---------------------------------------------------------------
${v2ray}
Expand Down
Binary file removed worker.old.zip
Binary file not shown.
Binary file removed worker.zip
Binary file not shown.

0 comments on commit c05e60a

Please sign in to comment.