Skip to content

Commit f7e7b43

Browse files
committed
fix: 更新Clash订阅配置文件热补丁,优化ECH链接生成逻辑并使用常量替代硬编码
1 parent 8542639 commit f7e7b43

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

_worker.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { connect } from "cloudflare:sockets";
22
let config_JSON, 反代IP = '', 启用SOCKS5反代 = null, 启用SOCKS5全局反代 = false, 我的SOCKS5账号 = '', parsedSocks5Address = {};
3-
let 缓存反代IP, 缓存反代解析数组, 缓存反代数组索引 = 0, 启用反代兜底 = true;
3+
let 缓存反代IP, 缓存反代解析数组, 缓存反代数组索引 = 0, 启用反代兜底 = true, ECH_DOH = 'https://doh.cmliussss.net/CMLiussss';
44
let SOCKS5白名单 = ['*tapecontent.net', '*cloudatacdn.com', '*loadshare.org', '*cdn-centaurus.com', 'scholar.google.com'];
55
const Pages静态页面 = 'https://edt-pages.github.io';
66
///////////////////////////////////////////////////////主程序入口///////////////////////////////////////////////
@@ -279,7 +279,7 @@ export default {
279279
return new Response('优选订阅生成器异常:' + error.message, { status: 403 });
280280
}
281281
}
282-
const ECHLINK参数 = config_JSON.ECH ? '&ech=' + encodeURIComponent(await getECH(config_JSON.HOST)) : '';
282+
const ECHLINK参数 = config_JSON.ECH ? `&ech=${encodeURIComponent(ECH_DOH)}` : '';
283283
订阅内容 = 其他节点LINK + 完整优选IP.map(原始地址 => {
284284
// 统一正则: 匹配 域名/IPv4/IPv6地址 + 可选端口 + 可选备注
285285
// 示例:
@@ -811,7 +811,7 @@ function Clash订阅配置文件热补丁(Clash_原始订阅内容, uuid = null,
811811
geoip-code: CN
812812
proxy-server-nameserver:
813813
- https://doh.cmliussss.com/CMLiussss
814-
- https://doh.cmliussss.net/CMLiussss
814+
- ${ECH_DOH}
815815
` + Clash_原始订阅内容;
816816

817817
if (!uuid) return clash_yaml;
@@ -1375,7 +1375,7 @@ async function 读取config_JSON(env, hostname, userID, path, 重置配置 = fal
13751375
if (!config_JSON.Fingerprint) config_JSON.Fingerprint = "chrome";
13761376
if (!config_JSON.ECH) config_JSON.ECH = false;
13771377
else config_JSON.优选订阅生成.SUBUpdateTime = 1; // 启用 ECH 时强制将订阅更新时间改为 1 小时
1378-
const ECHLINK参数 = config_JSON.ECH ? '&ech=' + encodeURIComponent(await getECH(config_JSON.HOST)) : '';
1378+
const ECHLINK参数 = config_JSON.ECH ? `&ech=${encodeURIComponent(ECH_DOH)}` : '';
13791379
config_JSON.LINK = `${config_JSON.协议类型}://${userID}@${host}:443?security=tls&type=${config_JSON.传输协议 + ECHLINK参数}&host=${host}&fp=${config_JSON.Fingerprint}&sni=${host}&path=${encodeURIComponent(config_JSON.启用0RTT ? config_JSON.PATH + '?ed=2560' : config_JSON.PATH) + TLS分片参数}&encryption=none${config_JSON.跳过证书验证 ? '&insecure=1&allowInsecure=1' : ''}#${encodeURIComponent(config_JSON.优选订阅生成.SUBNAME)}`;
13801380
config_JSON.优选订阅生成.TOKEN = await MD5MD5(hostname + userID);
13811381

0 commit comments

Comments
 (0)