我正在尝试找出如何更改PAC文件中打开的每个新URL的代理(总共10个代理)的方法,似乎找不到答案。
我最初的目标是在一天中每20分钟更换10个代理:
function FindProxyForURL(url, host) {
if (timeRange(00, 00, 00, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(00, 20, 00, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(00, 40, 01, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(01, 00, 01, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(01, 20, 01, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(01, 40, 02, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(02, 00, 02, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(02, 20, 02, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(02, 40, 03, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(03, 00, 03, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(03, 20, 03, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(03, 40, 04, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(04, 00, 04, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(04, 20, 04, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(04, 40, 05, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(05, 00, 05, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(05, 20, 05, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(05, 40, 06, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(06, 00, 06, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(06, 20, 06, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(06, 40, 07, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(07, 00, 07, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(07, 20, 07, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(07, 40, 08, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(08, 00, 08, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(08, 20, 08, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(08, 40, 09, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(09, 00, 09, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(09, 20, 09, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(09, 40, 10, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(10, 00, 10, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(10, 20, 10, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(10, 40, 11, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(11, 00, 11, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(11, 20, 11, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(11, 40, 12, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(12, 00, 12, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(12, 20, 12, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(12, 40, 13, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(13, 00, 13, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(13, 20, 13, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(13, 40, 14, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(14, 00, 14, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(14, 20, 14, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(14, 40, 15, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(15, 00, 15, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(15, 20, 15, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(15, 40, 16, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(16, 00, 16, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(16, 20, 16, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(16, 40, 17, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(17, 00, 17, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(17, 20, 17, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(17, 40, 18, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(18, 00, 18, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(18, 20, 18, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(18, 40, 19, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(19, 00, 19, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(19, 20, 19, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(19, 40, 20, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(20, 00, 20, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(20, 20, 20, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(20, 40, 21, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(21, 00, 21, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(21, 20, 21, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(21, 40, 22, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(22, 00, 22, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(22, 20, 22, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(22, 40, 23, 00)) return "PROXY 000.000.000.000:0000";
else if (timeRange(23, 00, 23, 20)) return "PROXY 000.000.000.000:0000";
else if (timeRange(23, 20, 23, 40)) return "PROXY 000.000.000.000:0000";
else if (timeRange(23, 40, 00, 00)) return "PROXY 000.000.000.000:0000";
else return "DIRECT";
}
唯一的区别-实际的代理IP地址。我还使用此扩展名(https://github.com/orbitbot/chrome-extensions-examples/tree/master/proxy_configuration)每5秒重新加载错误的pac路径并重新加载默认的pac。尚未为我工作,我开始收到此错误消息:
ERR_TUNNEL_CONNECTION_FAILED
结果是扩展程序无法更新pac文件,因此我只能使用一个代理。
我正在寻找更简单的解决方案来解决此问题,我绝对不是程序员。