mirror of
https://github.com/lush2020/edgetunnel.git
synced 2026-03-21 08:52:43 +08:00
更改添加proxyIPPool的逻辑
This commit is contained in:
@@ -156,6 +156,7 @@ Telegram交流群:[@CMLiussss](https://t.me/CMLiussss),**感谢[Alice Networ
|
||||
| URL | `https://blog.cmliussss.com` |❌| 主页反代伪装(支持多url, url之间使用`,`或`换行`作间隔, 乱设容易触发反诈) | |
|
||||
| CFEMAIL | `admin@gmail.com` |❌| CF账户邮箱(与`CFKEY`都填上后, 订阅信息将显示请求使用量, 小白别用) | |
|
||||
| CFKEY | `c6a944b5c956b6c18c2352880952bced8b85e` |❌| CF账户Global API Key(与`CFEMAIL`都填上后, 订阅信息将显示请求使用量, 小白别用) | |
|
||||
| CFPORTS | `2053`,`2096`,`8443` |❌| CF账户标准端口列表 | |
|
||||
|
||||
**注意: 填入`SOCKS5`后将不再启用`PROXYIP`!请二选一使用!!!**
|
||||
|
||||
|
||||
21
_worker.js
21
_worker.js
@@ -76,6 +76,7 @@ let ChatID ='';
|
||||
let proxyhosts = [];//本地代理域名池
|
||||
let proxyhostsURL = 'https://raw.githubusercontent.com/cmliu/CFcdnVmess2sub/main/proxyhosts';//在线代理域名池URL
|
||||
let RproxyIP = 'false';
|
||||
let httpsPorts = ["2053","2083","2087","2096","8443"];
|
||||
export default {
|
||||
/**
|
||||
* @param {import("@cloudflare/workers-types").Request} request
|
||||
@@ -105,7 +106,7 @@ export default {
|
||||
socks5s = await ADD(socks5Address);
|
||||
socks5Address = socks5s[Math.floor(Math.random() * socks5s.length)];
|
||||
socks5Address = socks5Address.split('//')[1] || socks5Address;
|
||||
|
||||
if (env.CFPORTS) httpsPorts = await ADD(env.CFPORTS);
|
||||
sub = env.SUB || sub;
|
||||
subconverter = env.SUBAPI || subconverter;
|
||||
if( subconverter.includes("http://") ){
|
||||
@@ -1652,8 +1653,16 @@ async function getAddressesapi(api) {
|
||||
// 如果URL带有'proxyip=true',则将内容添加到proxyIPPool
|
||||
proxyIPPool = proxyIPPool.concat((await ADD(content)).map(item => {
|
||||
const baseItem = item.split('#')[0] || item;
|
||||
return baseItem.includes(':') ? baseItem : `${baseItem}:443`;
|
||||
}));
|
||||
if (baseItem.includes(':')) {
|
||||
const port = baseItem.split(':')[1];
|
||||
if (!httpsPorts.includes(port)) {
|
||||
return baseItem;
|
||||
}
|
||||
} else {
|
||||
return `${baseItem}:443`;
|
||||
}
|
||||
return null; // 不符合条件时返回 null
|
||||
}).filter(Boolean)); // 过滤掉 null 值
|
||||
}
|
||||
// 将内容添加到newapi中
|
||||
newapi += content + '\n';
|
||||
@@ -1721,7 +1730,7 @@ async function getAddressescsv(tls) {
|
||||
|
||||
const formattedAddress = `${ipAddress}:${port}#${dataCenter}`;
|
||||
newAddressescsv.push(formattedAddress);
|
||||
if (csvUrl.includes('proxyip=true') && columns[tlsIndex].toUpperCase() == 'true') {
|
||||
if (csvUrl.includes('proxyip=true') && columns[tlsIndex].toUpperCase() == 'true' && !httpsPorts.includes(port)) {
|
||||
// 如果URL带有'proxyip=true',则将内容添加到proxyIPPool
|
||||
proxyIPPool.push(`${ipAddress}:${port}`);
|
||||
}
|
||||
@@ -1835,7 +1844,6 @@ function subAddresses(host,UUID,noTLS,newAddressesapi,newAddressescsv,newAddress
|
||||
addressid = match[3] || address;
|
||||
}
|
||||
|
||||
const httpsPorts = ["2053","2083","2087","2096","8443"];
|
||||
if (!isValidIPv4(address) && port == "-1") {
|
||||
for (let httpsPort of httpsPorts) {
|
||||
if (address.includes(httpsPort)) {
|
||||
@@ -1849,7 +1857,8 @@ function subAddresses(host,UUID,noTLS,newAddressesapi,newAddressescsv,newAddress
|
||||
let 伪装域名 = host ;
|
||||
let 最终路径 = '/?ed=2560' ;
|
||||
let 节点备注 = '';
|
||||
if (proxyIPPool.includes(`${address}:${port}`) && !httpsPorts.includes(port)) 最终路径 += `&proxyip=${address}:${port}`;
|
||||
const matchingProxyIP = proxyIPPool.find(proxyIP => proxyIP.includes(address));
|
||||
if (matchingProxyIP) 最终路径 += `&proxyip=${matchingProxyIP}`;
|
||||
|
||||
if(proxyhosts.length > 0 && (伪装域名.includes('.workers.dev') || 伪装域名.includes('pages.dev'))) {
|
||||
最终路径 = `/${伪装域名}${最终路径}`;
|
||||
|
||||
Reference in New Issue
Block a user