fix: 随机选择反代IP以增强代理请求的安全性

This commit is contained in:
cmliu committed 2025-11-19 13:18:17 +08:00
1 parent 1199103611
commit 221c5e3448
1 file changed
+4 -2
+4 -2
View File
@@ -1074,10 +1074,12 @@ async function 反代参数获取(request) {
// 统一处理反代IP参数 (优先级最高,使用正则一次匹配)
const proxyMatch = pathLower.match(/\/(proxyip[.=]|pyip=|ip=)(.+)/);
if (searchParams.has('proxyip')) {
反代IP = searchParams.get('proxyip');
const 路参IP = searchParams.get('proxyip');
反代IP = 路参IP.includes(',') ? 路参IP.split(',')[Math.floor(Math.random() * 路参IP.split(',').length)] : 路参IP;
return;
} else if (proxyMatch) {
反代IP = proxyMatch[1] === 'proxyip.' ? `proxyip.${proxyMatch[2]}` : proxyMatch[2];
const 路参IP = proxyMatch[1] === 'proxyip.' ? `proxyip.${proxyMatch[2]}` : proxyMatch[2];
反代IP = 路参IP.includes(',') ? 路参IP.split(',')[Math.floor(Math.random() * 路参IP.split(',').length)] : 路参IP;
return;
}