Skip to content

Commit 39c11e7

Browse files
authored
Merge pull request cmliu#941 from cmliu/beta2.0
Beta2.0
2 parents 2c6e49f + 4f79dcf commit 39c11e7

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

_worker.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { connect } from "cloudflare:sockets";
1+
import {
2+
connect
3+
} from "cloudflare:sockets";
24
let config_JSON, 反代IP = '', 启用SOCKS5反代 = null, 启用SOCKS5全局反代 = false, 我的SOCKS5账号 = '', parsedSocks5Address = {};
35
let 缓存反代IP, 缓存反代解析数组, 缓存反代数组索引 = 0, 启用反代兜底 = true;
46
let SOCKS5白名单 = ['*tapecontent.net', '*cloudatacdn.com', '*loadshare.org', '*cdn-centaurus.com', 'scholar.google.com'];
@@ -1446,13 +1448,15 @@ async function 读取config_JSON(env, hostname, userID, 重置配置 = false) {
14461448
if (env.PATH) config_JSON.PATH = env.PATH.startsWith('/') ? env.PATH : '/' + env.PATH;
14471449
else if (!config_JSON.PATH) config_JSON.PATH = '/';
14481450

1449-
const { SOCKS5, PROXYIP } = config_JSON.反代;
1450-
const PATH反代参数 = SOCKS5.启用 ? `${SOCKS5.启用}${SOCKS5.全局 ? '://' : '='}${SOCKS5.账号}` : (PROXYIP === 'auto' ? '' : `proxyip=${PROXYIP}`);
1451-
config_JSON.PATH = config_JSON.PATH.replace(PATH反代参数, '').replace('//', '/');
1451+
const { SOCKS5: 袜子五, PROXYIP: 反代挨批 } = config_JSON.反代;
1452+
const 路径反代参数 = 袜子五.启用
1453+
? `${袜子五.启用}${袜子五.全局 ? '://' : '='}${袜子五.账号}`
1454+
: 反代挨批 !== 'auto' ? `proxyip=${反代挨批}` : '';
1455+
config_JSON.PATH = config_JSON.PATH.replace(路径反代参数, '').replace('//', '/');
14521456
const normalizedPath = config_JSON.PATH === '/' ? '' : config_JSON.PATH.replace(/\/+(?=\?|$)/, '').replace(/\/+$/, '');
14531457
const [路径部分, ...查询数组] = normalizedPath.split('?');
14541458
const 查询部分 = 查询数组.length ? '?' + 查询数组.join('?') : '';
1455-
config_JSON.完整节点路径 = (路径部分 || '/') + (路径部分 && PATH反代参数 ? '/' : '') + PATH反代参数 + 查询部分 + (config_JSON.启用0RTT ? (查询部分 ? '&' : '?') + 'ed=2560' : '');
1459+
config_JSON.完整节点路径 = (路径部分 || '/') + (路径部分 && 路径反代参数 ? '/' : '') + 路径反代参数 + 查询部分 + (config_JSON.启用0RTT ? (查询部分 ? '&' : '?') + 'ed=2560' : '');
14561460

14571461
if (!config_JSON.TLS分片 && config_JSON.TLS分片 !== null) config_JSON.TLS分片 = null;
14581462
const TLS分片参数 = config_JSON.TLS分片 == 'Shadowrocket' ? `&fragment=${encodeURIComponent('1,40-60,30-50,tlshello')}` : config_JSON.TLS分片 == 'Happ' ? `&fragment=${encodeURIComponent('3,1,tlshello')}` : '';

0 commit comments

Comments
 (0)