Guest User

proxy.pac

a guest
Apr 30th, 2024
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var megafon_proxy = 1;
  2. var http_enabled = 1;
  3.  
  4.  
  5. var DIRECT = "DIRECT";
  6. var PROXY_HTTP = "DIRECT"; //
  7. var PROXY_SOCKS = "DIRECT"; //
  8.  
  9. if  (megafon_proxy) PROXY_HTTP = "PROXY 192.168.43.201:8888";
  10.  
  11. //proxy list
  12. var gi, proxyListed = {}, proxyList = [];
  13.  
  14. if (megafon_proxy) {
  15.     proxyList.push("2ch.hk");
  16. }
  17.  
  18. for (gi = 0; gi < proxyList.length; gi += 1)
  19. { proxyListed[proxyList[gi]] = true; }
  20.  
  21. function hostToDomain(host) {
  22.   var dotpos = host.lastIndexOf(".");
  23.   if (dotpos === -1) { return host; }
  24.  
  25.   // Find the second last dot
  26.   dotpos = host.lastIndexOf(".", dotpos - 1);
  27.   if (dotpos === -1) { return host; }
  28.  
  29.   return host.substring(dotpos + 1);
  30. }
  31.  
  32. function FindProxyForURL(url, host) {
  33.  
  34.  //checks host in antizapret, proxy lists, then select proxy type, else direct
  35.  return (proxyListed[hostToDomain(host)] ? (http_enabled ? PROXY_HTTP : PROXY_SOCKS) : DIRECT);
  36.  
  37. }
Add Comment
Please, Sign In to add comment