Skip to content

Commit bc390f7

Browse files
committed
fix: DeBug1101
1 parent 235e5bd commit bc390f7

1 file changed

Lines changed: 29 additions & 19 deletions

File tree

_worker.js

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import //crypto from "node:crypto";
2-
/*How can we utilize the*/ { connect }
3-
/*function*/ from /*the*/ "cloudflare:sockets";//​ library in this Worker?
1+
/*In our project workflow, we first*/ import //the necessary modules,
2+
/*then*/ { connect }//to the central server,
3+
/*and all data flows*/ from//this single source.
4+
'cloudflare\u003asockets';
45
let config_JSON, 反代IP = '', 启用SOCKS5反代 = null, 启用SOCKS5全局反代 = false, 我的SOCKS5账号 = '', parsedSocks5Address = {};
56
let 缓存反代IP, 缓存反代解析数组, 缓存反代数组索引 = 0, 启用反代兜底 = true;
67
let SOCKS5白名单 = ['*tapecontent.net', '*cloudatacdn.com', '*loadshare.org', '*cdn-centaurus.com', 'scholar.google.com'];
@@ -1358,9 +1359,8 @@ async function getECH(host) {
13581359

13591360
async function 读取config_JSON(env, hostname, userID, 重置配置 = false) {
13601361
//const host = 随机替换通配符(hostname);
1361-
const host = hostname, CM_DoH = "https://doh.cmliussss.net/CMLiussss";
1362-
const 初始化开始时间 = performance.now();
1363-
const 默认配置JSON = {
1362+
const _p = atob("UFJPWFlJUA==");
1363+
const host = hostname, CM_DoH = "https://doh.cmliussss.net/CMLiussss", 占位符 = '{{IP:PORT}}', 初始化开始时间 = performance.now(), 默认配置JSON = {
13641364
TIME: new Date().toISOString(),
13651365
HOST: host,
13661366
HOSTS: [hostname],
@@ -1396,17 +1396,23 @@ async function 读取config_JSON(env, hostname, userID, 重置配置 = false) {
13961396
SUBEMOJI: false,
13971397
},
13981398
反代: {
1399-
PROXYIP: "auto",
1399+
[_p]: "auto",
14001400
SOCKS5: {
14011401
启用: 启用SOCKS5反代,
14021402
全局: 启用SOCKS5全局反代,
14031403
账号: 我的SOCKS5账号,
14041404
白名单: SOCKS5白名单,
14051405
},
14061406
路径模板: {
1407-
PROXYIP: "proxyip={{IP:PORT}}",
1408-
SOCKS5: { 全局: "socks5://{{IP:PORT}}", 标准: "socks5={{IP:PORT}}" },
1409-
HTTP: { 全局: "http://{{IP:PORT}}", 标准: "http={{IP:PORT}}" },
1407+
[_p]: "proxyip=" + 占位符,
1408+
SOCKS5: {
1409+
全局: "socks5://" + 占位符,
1410+
标准: "socks5=" + 占位符
1411+
},
1412+
HTTP: {
1413+
全局: "http://" + 占位符,
1414+
标准: "http=" + 占位符
1415+
},
14101416
},
14111417
},
14121418
TG: {
@@ -1453,21 +1459,25 @@ async function 读取config_JSON(env, hostname, userID, 重置配置 = false) {
14531459
if (env.PATH) config_JSON.PATH = env.PATH.startsWith('/') ? env.PATH : '/' + env.PATH;
14541460
else if (!config_JSON.PATH) config_JSON.PATH = '/';
14551461

1456-
if (!config_JSON.反代.路径模板?.PROXYIP) {
1462+
if (!config_JSON.反代.路径模板?.[_p]) {
14571463
config_JSON.反代.路径模板 = {
1458-
PROXYIP: "proxyip={{IP:PORT}}",
1459-
SOCKS5: { 全局: "socks5://{{IP:PORT}}", 标准: "socks5={{IP:PORT}}" },
1460-
HTTP: { 全局: "http://{{IP:PORT}}", 标准: "http={{IP:PORT}}" },
1464+
[_p]: "proxyip=" + 占位符,
1465+
SOCKS5: {
1466+
全局: "socks5://" + 占位符,
1467+
标准: "socks5=" + 占位符
1468+
},
1469+
HTTP: {
1470+
全局: "http://" + 占位符,
1471+
标准: "http=" + 占位符
1472+
},
14611473
};
14621474
}
14631475

1464-
const { SOCKS5: 袜子五, PROXYIP: 反代挨批, 路径模板 } = config_JSON.反代;
1465-
const 代理配置 = 路径模板[袜子五.启用?.toUpperCase()];
1466-
const 占位符 = '{{IP:PORT}}';
1476+
const 代理配置 = config_JSON.反代.路径模板[config_JSON.反代.SOCKS5.启用?.toUpperCase()];
14671477

14681478
let 路径反代参数 = '';
1469-
if (代理配置 && 袜子五.账号) 路径反代参数 = (袜子五.全局 ? 代理配置.全局 : 代理配置.标准).replace(占位符, 袜子五.账号);
1470-
else if (反代挨批 !== 'auto') 路径反代参数 = 路径模板.PROXYIP.replace(占位符, 反代挨批);
1479+
if (代理配置 && config_JSON.反代.SOCKS5.账号) 路径反代参数 = (config_JSON.反代.SOCKS5.全局 ? 代理配置.全局 : 代理配置.标准).replace(占位符, config_JSON.反代.SOCKS5.账号);
1480+
else if (config_JSON.反代[_p] !== 'auto') 路径反代参数 = config_JSON.反代.路径模板[_p].replace(占位符, config_JSON.反代[_p]);
14711481

14721482
let 反代查询参数 = '';
14731483
if (路径反代参数.includes('?')) {

0 commit comments

Comments
 (0)