proxy.pac 995 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // This is an example proxy.pac file which can be used as the proxy configuration by URL
  2. //
  3. // file syntax is javascript
  4. // this is the return value if we do not use the proxy
  5. var direct = "DIRECT";
  6. // this is the return value if we use the proxy.
  7. // this returns multiple proxyies
  8. var proxy = "PROXY 10.0.1.12:80; PROXY 10.0.1.10:80; PROXY 10.0.1.11:80";
  9. function FindProxyForURL(url, host) {
  10. var lhost = host.toLowerCase();
  11. var resolved_ip = dnsResolve(host);
  12. host = lhost;
  13. var lurl = url.toLowerCase();
  14. url = lurl;
  15. if(isPlainHostName(host)) {
  16. return direct;
  17. }
  18. // local networks do not use a proxy
  19. if(
  20. (isInNet(resolved_ip, "10.0.0.0", "255.0.0.0")) ||
  21. (isInNet(resolved_ip, "192.168.0.0", "255.255.0.0")) ||
  22. (isInNet(resolved_ip, "127.0.0.1", "255.255.255.255"))
  23. ) {
  24. return direct;
  25. }
  26. // the local network uses some special tlds
  27. if(
  28. (host == "some.special.tld") ||
  29. (host == "some.special.interne.tld")
  30. ) {
  31. return direct;
  32. }
  33. return proxy;
  34. }