|
1 | | -import { connect } from "cloudflare:sockets"; |
| 1 | +import { |
| 2 | + connect |
| 3 | +} from "cloudflare:sockets"; |
2 | 4 | let config_JSON, 反代IP = '', 启用SOCKS5反代 = null, 启用SOCKS5全局反代 = false, 我的SOCKS5账号 = '', parsedSocks5Address = {}; |
3 | 5 | let 缓存反代IP, 缓存反代解析数组, 缓存反代数组索引 = 0, 启用反代兜底 = true; |
4 | 6 | 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) { |
1446 | 1448 | if (env.PATH) config_JSON.PATH = env.PATH.startsWith('/') ? env.PATH : '/' + env.PATH; |
1447 | 1449 | else if (!config_JSON.PATH) config_JSON.PATH = '/'; |
1448 | 1450 |
|
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('//', '/'); |
1452 | 1456 | const normalizedPath = config_JSON.PATH === '/' ? '' : config_JSON.PATH.replace(/\/+(?=\?|$)/, '').replace(/\/+$/, ''); |
1453 | 1457 | const [路径部分, ...查询数组] = normalizedPath.split('?'); |
1454 | 1458 | const 查询部分 = 查询数组.length ? '?' + 查询数组.join('?') : ''; |
1455 | | - config_JSON.完整节点路径 = (路径部分 || '/') + (路径部分 && PATH反代参数 ? '/' : '') + PATH反代参数 + 查询部分 + (config_JSON.启用0RTT ? (查询部分 ? '&' : '?') + 'ed=2560' : ''); |
| 1459 | + config_JSON.完整节点路径 = (路径部分 || '/') + (路径部分 && 路径反代参数 ? '/' : '') + 路径反代参数 + 查询部分 + (config_JSON.启用0RTT ? (查询部分 ? '&' : '?') + 'ed=2560' : ''); |
1456 | 1460 |
|
1457 | 1461 | if (!config_JSON.TLS分片 && config_JSON.TLS分片 !== null) config_JSON.TLS分片 = null; |
1458 | 1462 | 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