Difference between revisions of "Rotate IPs"

From FoxyProxy Documentation
Jump to: navigation, search
m
Line 1: Line 1:
FAQ to explain how to use a PAC file to automatically rotate IPs
+
==How to use a PAC file to automatically rotate IPs==
  
  
+
  <nowiki> // PAC file to switch IP addresses every 3 seconds across 5 IP addresses
  <nowiki> // PAC file to switch IP addresses every 10 seconds
+
  
  var proxies = ["PROXY myproxy.foo.com:9050", "PROXY myproxy.bar.com:8080",
+
  var proxies = ["PROXY 123.123.123.123:9050", "PROXY 192.168.1.3:8080",
  "PROXY myproxy.baz.com:6667"], t1 = new Date().getTime(), counter = 1;
+
  "PROXY 108.54.23.11:6667", "PROXY 106.25.84.11:6667", "PROXY 143.51.88.76:6667"],
 +
  t1 = new Date().getTime(), counter = 1;
  
  var secondsToSwitchAfter = 10;
+
  var secondsToSwitchAfter = 3;
  
 
  function FindProxyForURL(url, host) {
 
  function FindProxyForURL(url, host) {

Revision as of 18:04, 25 April 2013

How to use a PAC file to automatically rotate IPs

 // PAC file to switch IP addresses every 3 seconds across 5 IP addresses

 var proxies = ["PROXY 123.123.123.123:9050", "PROXY 192.168.1.3:8080",
 "PROXY 108.54.23.11:6667", "PROXY 106.25.84.11:6667", "PROXY 143.51.88.76:6667"],
  t1 = new Date().getTime(), counter = 1;

 var secondsToSwitchAfter = 3;

 function FindProxyForURL(url, host) {
   var t2 = new Date.getTime();
   if (t2 - t1 > secondsToSwitchAfter * 1000)
     counter++;
   t1 = t2;
   return proxies[counter % proxies.length];
 }