ADDAPI可作为PROXYIP使用

This commit is contained in:
cmliu
2024-10-03 03:36:13 +08:00
parent 2201376067
commit ad562ab9c8
2 changed files with 40 additions and 12 deletions

View File

@@ -191,17 +191,27 @@ Telegram交流群[@CMLiussss](https://t.me/CMLiussss)**感谢[Alice Networ
/socks5://user:password@127.0.0.1:1080
```
**当你的`ADDAPI`可作为`PROXYIP`时,可在`ADDAPI`变量末位添加`?proxyip=true`即可在生成节点时使用优选IP自身作为`PROXYIP`**
- 指定 `ADDAPI` 作为 `PROXYIP` 案例
```url
https://raw.githubusercontent.com/cmliu/WorkerVless2sub/main/addressesapi.txt?proxyip=true
```
## Star 星星走起
[![Stargazers over time](https://starchart.cc/cmliu/edgetunnel.svg?variant=adaptive)](https://starchart.cc/cmliu/edgetunnel)
## 已适配自适应订阅内容
## 已适配客户端
### Windows
- [v2rayN](https://github.com/2dust/v2rayN)
- clash.meta[clash-verge-rev
](https://github.com/clash-verge-rev/clash-verge-rev)[Clash Nyanpasu](https://github.com/keiko233/clash-nyanpasu)~[clash-verge](https://github.com/zzzgydi/clash-verge/tree/main)~ClashX Meta
- sing-boxSFI
- clash.meta[FlClash](https://github.com/chen08209/FlClash)[clash-verge-rev](https://github.com/clash-verge-rev/clash-verge-rev)[Clash Nyanpasu](https://github.com/keiko233/clash-nyanpasu)
### IOS
- Surge小火箭
- sing-box[SFI](https://sing-box.sagernet.org/zh/clients/apple/)
### 安卓
- clash.meta[ClashMetaForAndroid](https://github.com/MetaCubeX/ClashMetaForAndroid)[FlClash](https://github.com/chen08209/FlClash)
- sing-box[SFA](https://github.com/SagerNet/sing-box)
### MacOS
- clash.meta[FlClash](https://github.com/chen08209/FlClash)
# 感谢
[zizifn](https://github.com/zizifn/edgetunnel)、[3Kmfi6HP](https://github.com/3Kmfi6HP/EDtunnel)、[Stanley-baby](https://github.com/Stanley-baby)、[ACL4SSR](https://github.com/ACL4SSR/ACL4SSR/tree/master/Clash/config)、[SHIJS1999](https://github.com/SHIJS1999/cloudflare-worker-vless-ip)、<a href="https://url.cmliussss.com/alice"><img src="https://alicenetworks.net/templates/lagom2/assets/img/logo/logo_big.194980063.png" width="150" height="75" alt="Alice Networks LTD"/></a>、

View File

@@ -150,7 +150,12 @@ export default {
case '/':
if (env.URL302) return Response.redirect(env.URL302, 302);
else if (env.URL) return await proxyURL(env.URL, url);
else return new Response(JSON.stringify(request.cf, null, 4), { status: 200 });
else return new Response(JSON.stringify(request.cf, null, 4), {
status: 200,
headers: {
'content-type': 'application/json',
},
});
case `/${fakeUserID}`:
const fakeConfig = await getVLESSConfig(userID, request.headers.get('Host'), sub, 'CF-Workers-SUB', RproxyIP, url);
return new Response(`${fakeConfig}`, { status: 200 });
@@ -1610,11 +1615,9 @@ async function getSum(accountId, accountIndex, email, key, startDate, endDate) {
return [ 0,0 ];
}
}
let proxyIPPool = [];
async function getAddressesapi(api) {
if (!api || api.length === 0) {
return [];
}
if (!api || api.length === 0) return [];
let newapi = "";
@@ -1638,11 +1641,21 @@ async function getAddressesapi(api) {
}).then(response => response.ok ? response.text() : Promise.reject())));
// 遍历所有响应
for (const response of responses) {
for (const [index, response] of responses.entries()) {
// 检查响应状态是否为'fulfilled',即请求成功完成
if (response.status === 'fulfilled') {
// 获取响应的内容
const content = await response.value;
// 验证当前apiUrl是否带有'proxyip=true'
if (api[index].includes('proxyip=true')) {
// 如果URL带有'proxyip=true'则将内容添加到proxyIPPool
proxyIPPool = proxyIPPool.concat((await ADD(content)).map(item => {
const baseItem = item.split('#')[0] || item;
return baseItem.includes(':') ? baseItem : `${baseItem}:443`;
}));
}
// 将内容添加到newapi中
newapi += content + '\n';
}
}
@@ -1708,6 +1721,10 @@ async function getAddressescsv(tls) {
const formattedAddress = `${ipAddress}:${port}#${dataCenter}`;
newAddressescsv.push(formattedAddress);
if (csvUrl.includes('proxyip=true') && columns[tlsIndex].toUpperCase() == 'true') {
// 如果URL带有'proxyip=true'则将内容添加到proxyIPPool
proxyIPPool.push(`${ipAddress}:${port}`);
}
}
}
} catch (error) {
@@ -1832,6 +1849,7 @@ 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}`;
if(proxyhosts.length > 0 && (伪装域名.includes('.workers.dev') || 伪装域名.includes('pages.dev'))) {
最终路径 = `/${伪装域名}${最终路径}`;