Sha256: a682fdd9a53e263973ca039a78859b5d87ad13ac3e9298c3b3b6c3f2cdfcb02d

Contents?: true

Size: 1.48 KB

Versions: 14

Compression:

Stored size: 1.48 KB

Contents

// Taken from http://findproxyforurl.com/pac-functions/. Please see this site
// for an explanation for the snippets found below.

function FindProxyForURL(url, host) {
  if (dnsDomainIs(host, ".google.com"))
    return "DIRECT";

  if (shExpMatch(url, "*.local"))
    return "DIRECT";

  if (shExpMatch(host, "vpn.domain.com") ||
      shExpMatch(url, "http://abcdomain.com/folder/*"))
    return "DIRECT";

  if (isInNet(dnsResolve(host), "172.16.0.0", "255.240.0.0"))
    return "DIRECT";


  if (isInNet(myIpAddress(), "10.10.1.0", "255.255.255.0"))
    return "PROXY 10.10.5.1:8080";

  if (isInNet(dnsResolve(host), "10.0.0.0", "255.0.0.0") ||
      isInNet(dnsResolve(host), "172.16.0.0",  "255.240.0.0") ||
      isInNet(dnsResolve(host), "192.168.0.0", "255.255.0.0") ||
      isInNet(dnsResolve(host), "127.0.0.0", "255.255.255.0"))
    return "DIRECT";

  if (isPlainHostName(host))
    return "DIRECT";

  if (localHostOrDomainIs(host, "www.google.com"))
    return "DIRECT";

  if (localHostOrDomainIs(host, ".google.com"))
    return "DIRECT";


  if (isResolvable(host))
    return "PROXY proxy1.example.com:8080";
  if (dnsDomainLevels(host) > 0)
    return "PROXY proxy1.example.com:8080";
  else return "DIRECT";

  if (weekdayRange("MON", "FRI")) return "PROXY proxy1.example.com:8080";
  else return "DIRECT";
  if (dateRange("JAN", "MAR")) return "PROXY proxy1.example.com:8080";
  else return "DIRECT";
  if (timeRange(8, 18)) return "PROXY proxy1.example.com:8080";
  else return "DIRECT";

}

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
local_pac-0.10.2 files/examples/proxy-function_demo.pac.example
local_pac-0.10.1 files/examples/proxy-function_demo.pac.example
local_pac-0.10.0 files/examples/proxy-function_demo.pac.example
local_pac-0.9.0 files/examples/proxy-function_demo.pac.example
local_pac-0.7.0 files/examples/proxy-function_demo.pac.example
local_pac-0.6.3 files/examples/proxy-function_demo.pac.example
local_pac-0.6.2 files/examples/proxy-function_demo.pac.example
local_pac-0.6.1 files/examples/proxy-function_demo.pac.example
local_pac-0.5.0 files/examples/proxy-function_demo.pac.example
local_pac-0.4.0 files/examples/proxy-function_demo.pac.example
local_pac-0.3.0 files/examples/proxy-function_demo.pac.example
local_pac-0.2.3 files/examples/proxy-function_demo.pac.example
local_pac-0.2.2 files/examples/proxy-function_demo.pac.example
local_pac-0.2.1 files/examples/proxy-function_demo.pac.example