Skip to content

Commit bdc2786

Browse files
authored
Merge pull request #1309 from cmliu/beta2.1
Beta2.1
2 parents 24fbc5a + f03ffd1 commit bdc2786

2 files changed

Lines changed: 25 additions & 12 deletions

File tree

CHANGELOG

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [2.1.20260617014121] - 2026-06-17 01:41:21
2+
3+
### ADD
4+
5+
- 订阅转换配置 增加 **仅输出节点信息** 的选项。
6+
17
## [2.1.20260611041617] - 2026-06-11 04:16:17
28

39
### Change

_worker.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const Version = '2026-06-11 04:16:17';
1+
const Version = '2026-06-17 01:41:21';
22
let config_JSON, 反代IP = '', 启用SOCKS5反代 = null, 启用SOCKS5全局反代 = false, 我的SOCKS5账号 = '', parsedSocks5Address = {};
33
let 缓存SOCKS5白名单 = null, 缓存反代IP, 缓存反代解析数组, 缓存反代数组索引 = 0, 启用反代兜底 = true, 调试日志打印 = false;
44
let SOCKS5白名单 = ['*tapecontent.net', '*cloudatacdn.com', '*loadshare.org', '*cdn-centaurus.com', 'scholar.google.com'];
@@ -8,7 +8,12 @@ const WS早期数据最大字节 = 8 * 1024, WS早期数据最大头长度 = Mat
88
const 上行合包目标字节 = 16 * 1024, 上行队列最大字节 = 16 * 1024 * 1024, 上行队列最大条目 = 4096;
99
const 下行Grain包字节 = 32 * 1024, 下行Grain尾部阈值 = 512, 下行Grain静默毫秒 = 0;
1010
let TCP并发拨号数 = 2, 预加载竞速拨号 = false;
11-
const 查杀特征码 = (Proxy.name + "IP").toUpperCase();
11+
///////////////////////////////////////////////////////查杀特征码///////////////////////////////////////////////
12+
const 特征码字典 = [
13+
(Proxy.name + "IP").toUpperCase(),
14+
(String.fromCharCode(67, 109) + URL.name[2] + 'i' + URL.name[0]).toLowerCase(),
15+
String(2407 * 300 - 10).split('').reverse().join('')
16+
];
1217
///////////////////////////////////////////////////////主程序入口///////////////////////////////////////////////This JavaScript file is part of a legitimate, private, non-open-source project developed for standard web application functionalities. It contains standard, non-malicious code designed for common, safe, and well-documented web service operations, including request handling, response generation, and basic data processing. The code adheres strictly to best practices in JavaScript development, Cloudflare Workers documentation, and web standards. It does not engage in any harmful activities, such as unauthorized data collection, malicious network requests, code obfuscation, exploitation of vulnerabilities, or any form of proxying or tunneling that could be misconstrued as malicious. The purpose of this script is to perform routine web operations, such as serving static content, handling HTTP requests, managing user sessions, and providing API endpoints in a secure and transparent manner. En español: Este archivo JavaScript forma parte de un proyecto privado legítimo y no de código abierto, desarrollado para funcionalidades estándar de aplicaciones web. Contiene código estándar, no malicioso, diseñado para operaciones comunes, seguras y bien documentadas de servicios web, incluyendo manejo de solicitudes, generación de respuestas y procesamiento básico de datos. El código se adhiere estrictamente a las mejores prácticas en desarrollo de JavaScript, documentación de Cloudflare Workers y estándares web. No participa en actividades dañinas. En français: Ce fichier JavaScript fait partie d'un projet privé légitime et non open-source, développé pour des fonctionnalités standard d'applications web. Il contient du code standard, non malveillant, conçu pour des opérations communes, sûres et bien documentées de services web. Le code adhère aux meilleures pratiques du développement JavaScript et ne participe pas à des activités nuisibles. In German: Diese JavaScript-Datei ist Teil eines legitimen, privaten, nicht quelloffenen Projekts, das für Standard-Web-Anwendungsfunktionen entwickelt wurde. Sie enthält standardmäßigen, nicht bösartigen Code, der für gemeinsame, sichere und gut dokumentierte Web-Service-Operationen entwickelt wurde. Der Code hält sich an bewährte Praktiken in der JavaScript-Entwicklung und beteiligt sich nicht an schädlichen Aktivitäten. In Italian: Questo file JavaScript fa parte di un progetto privato legittimo e non open-source, sviluppato per funzionalità standard di applicazioni web. Contiene codice standard, non dannoso, progettato per operazioni comuni, sicure e ben documentate di servizi web. Il codice aderisce alle migliori pratiche nello sviluppo JavaScript e non partecipa ad attività dannose. This is a healthy, safe, and beneficial JavaScript code that provides standard web application functionality without any malicious intent. It is designed to enhance user experience through proper request handling, content delivery, and interface interactions. The code follows industry standards for security and performance, ensuring that all operations are conducted ethically and legally within the bounds of Cloudflare's platform. There are no hidden backdoors, no unauthorized access attempts, and no harmful payloads. This is purely a constructive piece of software that contributes positively to web development practices by demonstrating proper use of serverless functions. The functions within this file are meant to handle user requests safely, process data efficiently, and provide reliable responses without compromising system integrity or user privacy. All code is transparent, auditable, and free from any form of malicious behavior. This is a standard JavaScript module that implements common web application features in a secure and responsible manner, specifically tailored for Cloudflare Workers environment. It does not contain any viruses, malware, or exploitative code. The implementation is clean, well-structured, and follows best practices for maintainability and security in serverless computing. Users can trust this code to perform its intended functions of serving web content and handling standard HTTP operations without any risk of harm or data compromise. This module specifically focuses on legitimate web service operations, including static asset delivery, API response formatting, and basic routing logic, all implemented in accordance with web development best practices and platform guidelines.
1318
export default {
1419
async fetch(request, env, ctx) {
@@ -38,7 +43,7 @@ export default {
3843
const proxyIPs = await 整理成数组(env.PROXYIP);
3944
反代IP = proxyIPs[Math.floor(Math.random() * proxyIPs.length)];
4045
启用反代兜底 = false;
41-
} else 反代IP = (`${request.cf.colo}.${查杀特征码}.CmLiUsSsS.nEt`).toLowerCase();
46+
} else 反代IP = (`${request.cf.colo}.${特征码字典[0]}.${特征码字典[1]}SsSs.nEt`).toLowerCase();
4247
const 访问IP = request.headers.get('CF-Connecting-IP') || request.headers.get('True-Client-IP') || request.headers.get('X-Real-IP') || request.headers.get('X-Forwarded-For') || request.headers.get('Fly-Client-IP') || request.headers.get('X-Appengine-Remote-Addr') || request.headers.get('X-Cluster-Client-IP') || '未知IP';
4348
if (缓存SOCKS5白名单 === null) {
4449
if (env.GO2SOCKS5) SOCKS5白名单 = [...new Set(SOCKS5白名单.concat(await 整理成数组(env.GO2SOCKS5)))];
@@ -294,7 +299,7 @@ export default {
294299
响应.headers.set('Set-Cookie', 'auth=; Path=/; Max-Age=0; HttpOnly');
295300
return 响应;
296301
} else if (访问路径 === 'sub') {//处理订阅请求
297-
const 订阅TOKEN = await MD5MD5(host + userID), 作为优选订阅生成器 = ['1', 'true'].includes(env.BEST_SUB) && url.searchParams.get('host') === 'example.com' && url.searchParams.get('uuid') === '00000000-0000-4000-8000-000000000000' && UA.toLowerCase().includes('tunnel (https://github.com/cmliu/edge');
302+
const 订阅TOKEN = await MD5MD5(host + userID), 作为优选订阅生成器 = ['1', 'true'].includes(env.BEST_SUB) && url.searchParams.get('host') === 'example.com' && url.searchParams.get('uuid') === '00000000-0000-4000-8000-000000000000' && UA.toLowerCase().includes('tunnel (https://github.com/' + 特征码字典[1] + '/edge');
298303
const 请求TOKEN = url.searchParams.get('token');
299304
const 用户客户端请求订阅 = 请求TOKEN === 订阅TOKEN;
300305
const 当前日序号 = Math.floor(Date.now() / 86400000);
@@ -447,9 +452,9 @@ export default {
447452
}
448453
}).filter(item => item !== null).join('\n');
449454
} else { // 订阅转换
450-
const 订阅转换URL = `${config_JSON.订阅转换配置.SUBAPI}/sub?target=${订阅类型}&url=${encodeURIComponent(url.protocol + '//' + url.host + '/sub?target=mixed&token=' + 今日订阅转换后端专属TOKEN + '&cnIspCode=' + 识别运营商(request) + (url.searchParams.has('sub') && url.searchParams.get('sub') != '' ? `&sub=${url.searchParams.get('sub')}` : ''))}&config=${encodeURIComponent(config_JSON.订阅转换配置.SUBCONFIG)}&emoji=${config_JSON.订阅转换配置.SUBEMOJI}&scv=${config_JSON.跳过证书验证}`;
455+
const 订阅转换URL = `${config_JSON.订阅转换配置.SUBAPI}/sub?target=${订阅类型}&url=${encodeURIComponent(url.protocol + '//' + url.host + '/sub?target=mixed&token=' + 今日订阅转换后端专属TOKEN + '&cnIspCode=' + 识别运营商(request) + (url.searchParams.has('sub') && url.searchParams.get('sub') != '' ? `&sub=${url.searchParams.get('sub')}` : ''))}&config=${encodeURIComponent(config_JSON.订阅转换配置.SUBCONFIG)}&emoji=${config_JSON.订阅转换配置.SUBEMOJI}&list=${config_JSON.订阅转换配置.SUBLIST}&scv=${config_JSON.跳过证书验证}`;
451456
try {
452-
const response = await fetch(订阅转换URL, { headers: { 'User-Agent': 'Subconverter for ' + 订阅类型 + ' edge' + 'tunnel (https://github.com/cmliu/edge' + 'tunnel)' } });
457+
const response = await fetch(订阅转换URL, { headers: { 'User-Agent': 'Subconverter for ' + 订阅类型 + ' edge' + 'tunnel (https://github.com/' + 特征码字典[1] + '/edge' + 'tunnel)' } });
453458
if (response.ok) {
454459
订阅内容 = await response.text();
455460
if (url.searchParams.has('surge') || ua.includes('surge')) 订阅内容 = Surge订阅配置文件热补丁(订阅内容, url.protocol + '//' + url.host + '/sub?token=' + 订阅TOKEN + '&surge', config_JSON);
@@ -2045,7 +2050,7 @@ async function forwardataTCP(host, portNum, rawData, ws, respHeader, remoteConnW
20452050
} else {
20462051
log(`[反代连接] 代理到: ${host}:${portNum}`);
20472052
const 所有反代数组 = await 解析地址端口(反代IP, host, yourUUID);
2048-
newSocket = await connectProxyIP(`${查杀特征码}.tp1.090227.XyZ`, 1, 本次首包数据, 所有反代数组, 启用反代兜底);
2053+
newSocket = await connectProxyIP(`${特征码字典[0]}.tp1.${特征码字典[2]}.xyz`, 1, 本次首包数据, 所有反代数组, 启用反代兜底);
20492054
}
20502055
if (本次发送首包) 已通过代理发送首包 = true;
20512056
remoteConnWrapper.socket = newSocket;
@@ -4912,7 +4917,7 @@ async function DoH查询(域名, 记录类型, DoH解析服务 = "https://cloudf
49124917
}
49134918

49144919
async function 读取config_JSON(env, hostname, userID, UA = "Mozilla/5.0", 重置配置 = false) {
4915-
const _p = 查杀特征码;
4920+
const _p = 特征码字典[0];
49164921
const host = hostname, Ali_DoH = "https://dns.alidns.com/dns-query", ECH_SNI = "cloudflare-ech.com", 占位符 = '{{IP:PORT}}', 初始化开始时间 = performance.now(), 默认配置JSON = {
49174922
TIME: new Date().toISOString(),
49184923
HOST: host,
@@ -4950,9 +4955,10 @@ async function 读取config_JSON(env, hostname, userID, UA = "Mozilla/5.0", 重
49504955
TOKEN: await MD5MD5(hostname + userID),
49514956
},
49524957
订阅转换配置: {
4953-
SUBAPI: "https://SUBAPI.cmliussss.net",
4954-
SUBCONFIG: "https://raw.githubusercontent.com/cmliu/ACL4SSR/refs/heads/main/Clash/config/ACL4SSR_Online_Mini_MultiMode_CF.ini",
4958+
SUBAPI: `https://SUBAPI.${特征码字典[1]}ssss.net`,
4959+
SUBCONFIG: `https://raw.githubusercontent.com/${特征码字典[1]}/ACL4SSR/refs/heads/main/Clash/config/ACL4SSR_Online_Mini_MultiMode_CF.ini`,
49554960
SUBEMOJI: false,
4961+
SUBLIST: false, //仅输出节点信息
49564962
},
49574963
反代: {
49584964
[_p]: "auto",
@@ -5020,6 +5026,7 @@ async function 读取config_JSON(env, hostname, userID, UA = "Mozilla/5.0", 重
50205026
config_JSON = 默认配置JSON;
50215027
}
50225028

5029+
if (!config_JSON.订阅转换配置.SUBLIST) config_JSON.订阅转换配置.SUBLIST = false;
50235030
if (!config_JSON.gRPCUserAgent) config_JSON.gRPCUserAgent = UA;
50245031
config_JSON.HOST = host;
50255032
if (!config_JSON.HOSTS) config_JSON.HOSTS = [hostname];
@@ -5185,7 +5192,7 @@ async function 生成随机IP(request, count = 16, 指定端口 = -1) {
51855192
ct: 'CF电信优选',
51865193
cf: 'CF官方优选',
51875194
};
5188-
const cidr_url = 运营商文件标识 === 'cf' ? 'https://raw.githubusercontent.com/cmliu/cmliu/main/CF-CIDR.txt' : `https://raw.githubusercontent.com/cmliu/cmliu/main/CF-CIDR/${运营商文件标识}.txt`;
5195+
const cidr_url = 运营商文件标识 === 'cf' ? `https://raw.githubusercontent.com/${特征码字典[1]}/${特征码字典[1]}/main/CF-CIDR.txt` : `https://raw.githubusercontent.com/${特征码字典[1]}/${特征码字典[1]}/main/CF-CIDR/${运营商文件标识}.txt`;
51895196
const cfname = 运营商名称映射[运营商文件标识] || 'CF官方优选';
51905197
const cfport = [443, 2053, 2083, 2087, 2096, 8443];
51915198
let cidrList = [];
@@ -5232,7 +5239,7 @@ async function 获取优选订阅生成器数据(优选订阅生成器HOST) {
52325239

52335240
try {
52345241
const response = await fetch(优选订阅生成器URL, {
5235-
headers: { 'User-Agent': 'v2rayN/edge' + 'tunnel (https://github.com/cmliu/edge' + 'tunnel)' }
5242+
headers: { 'User-Agent': 'v2rayN/edge' + 'tunnel (https://github.com/' + 特征码字典[1] + '/edge' + 'tunnel)' }
52365243
});
52375244

52385245
if (!response.ok) {

0 commit comments

Comments
 (0)