From 4c506aea48a124e6ba5816708c9407782621d782 Mon Sep 17 00:00:00 2001 From: cmliu Date: Mon, 2 Sep 2024 23:45:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8F=98=E9=87=8FSOCKS5?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=A4=9Asocks5=EF=BC=8C=E9=9A=8F=E6=9C=BA?= =?UTF-8?q?=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- _worker.js | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ba24dd3..ffd0563 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,7 @@ Telegram交流群:[@CMLiussss](https://t.me/CMLiussss),**感谢[Alice Networ |--------|---------|-|-----|-----| | UUID | `90cd4a77-141a-43c9-991b-08263cfe9c10` |✅| Powershell -NoExit -Command "[guid]::NewGuid()"| [Video](https://www.youtube.com/watch?v=s91zjpw3-P8&t=72s) | | PROXYIP | `proxyip.fxxk.dedyn.io` |❌| 备选作为访问CFCDN站点的代理节点(支持多ProxyIP, ProxyIP之间使用`,`或 换行 作间隔) | [Video](https://www.youtube.com/watch?v=s91zjpw3-P8&t=166s) | -| SOCKS5 | `user:password@127.0.0.1:1080` |❌| 优先作为访问CFCDN站点的SOCKS5代理 | [Video](https://www.youtube.com/watch?v=s91zjpw3-P8&t=826s) | +| SOCKS5 | `user:password@127.0.0.1:1080` |❌| 优先作为访问CFCDN站点的SOCKS5代理(支持多socks5, socks5之间使用`,`或 换行 作间隔) | [Video](https://www.youtube.com/watch?v=s91zjpw3-P8&t=826s) | | ADD | `icook.tw:2053#官方优选域名` |❌| 本地优选TLS域名/优选IP(支持多元素之间`,`或 换行 作间隔) || | ADDAPI | [https://raw.github.../addressesapi.txt](https://raw.githubusercontent.com/cmliu/WorkerVless2sub/main/addressesapi.txt) |❌| 优选IP的API地址(支持多元素之间`,`或 换行 作间隔) || | ADDNOTLS | `icook.hk:8080#官方优选域名` |❌| 本地优选noTLS域名/优选IP(支持多元素之间`,`或 换行 作间隔) || diff --git a/_worker.js b/_worker.js index dd69285..6146d68 100644 --- a/_worker.js +++ b/_worker.js @@ -30,6 +30,7 @@ let fakeHostName ; let noTLS = 'false'; const expire = 4102329600;//2099-12-31 let proxyIPs; +let socks5s; let addresses = []; let addressesapi = []; let addressesnotls = []; @@ -68,6 +69,10 @@ export default { proxyIP = proxyIPs[Math.floor(Math.random() * proxyIPs.length)]; //console.log(proxyIP); socks5Address = env.SOCKS5 || socks5Address; + socks5s = await ADD(socks5Address); + socks5Address = socks5s[Math.floor(Math.random() * socks5s.length)]; + socks5Address = socks5Address.split('//')[1] || socks5Address; + sub = env.SUB || sub; subconverter = env.SUBAPI || subconverter; if( subconverter.includes("http://") ){ @@ -1237,14 +1242,20 @@ async function getVLESSConfig(userID, hostName, sub, UA, RproxyIP, _url) { if ( userAgent.includes('mozilla') && !subParams.some(_searchParams => _url.searchParams.has(_searchParams))) { let 订阅器 = `您的订阅内容由 ${sub} 提供维护支持, 自动获取ProxyIP: ${RproxyIP}`; + const newSocks5s = socks5s.map(socks5Address => { + if (socks5Address.includes('@')) return socks5Address.split('@')[1]; + else if (socks5Address.includes('//')) return socks5Address.split('//')[1]; + else return socks5Address; + }); if (!sub || sub == '') { if (!proxyIP || proxyIP =='') { - 订阅器 = '您的订阅内容由 内置 addresses/ADD 参数提供, 当前使用的ProxyIP为空, 推荐您设置 proxyIP/PROXYIP !!!'; + if (enableSocks) 订阅器 += `您的订阅内容由 内置 addresses/ADD 参数提供, 当前使用的Socks5: ${newSocks5s.join(', ')}`; + else 订阅器 = '您的订阅内容由 内置 addresses/ADD 参数提供, 当前使用的ProxyIP为空, 推荐您设置 proxyIP/PROXYIP !!!'; } else { 订阅器 = `您的订阅内容由 内置 addresses/ADD 参数提供, 当前使用的ProxyIP: ${proxyIPs.join(', ')}`; } } else if (RproxyIP != 'true'){ - if (enableSocks) 订阅器 += `, 当前使用的Socks5: ${parsedSocks5Address.hostname}:${String(parsedSocks5Address.port)}`; + if (enableSocks) 订阅器 += `, 当前使用的Socks5: ${newSocks5s.join(', ')}`; else 订阅器 += `, 当前使用的ProxyIP: ${proxyIPs.join(', ')}`; } return ` @@ -1723,4 +1734,4 @@ async function sendMessage(type, ip, add_data = "") { function isValidIPv4(address) { const ipv4Regex = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/; return ipv4Regex.test(address); -} +} \ No newline at end of file