File: px-manager-sample.pac

package info (click to toggle)
libproxy 0.5.12-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 728 kB
  • sloc: ansic: 3,455; sh: 228; python: 128; makefile: 37; cs: 18; perl: 6
file content (37 lines) | stat: -rw-r--r-- 1,037 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function FindProxyForURL(url, host)
{
  var resolved_ip = dnsResolve(host);
  var myIP = myIpAddress();
  var privateIP = /^(0|10|127|192\.168|172\.1[6789]|172\.2[0-9]|172\.3[01]|169\.254|192\.88\.99)\.[0-9.]+$/;

  if (shExpMatch(host, "192.168.10.4"))
    return "SOCKS 127.0.0.1:1983"

  if (dnsDomainIs(host, "192.168.10.5"))
    return "SOCKS4 127.0.0.1:1983"

  if (dnsDomainIs(host, "192.168.10.6"))
    return "SOCKS4A 127.0.0.1:1983"

  if (dnsDomainIs(host, "192.168.10.7"))
    return "SOCKS5 127.0.0.1:1983"

  /* Invalid return */
  if (dnsDomainIs(host, "192.168.10.8"))
    return "PROXY %%"

  /* Invalid return */
  if (dnsDomainIs(host, "192.168.10.9"))
    return "INVALID"

  alert("DEFAULT")

  if (dnsDomainIs(host, "www.example.com"))
    return "PROXY 127.0.0.1:1984; DIRECT"

  /* Don't send non-FQDN or private IP auths to us */
  if (isPlainHostName(host) || isInNet(resolved_ip, "192.0.2.0","255.255.255.0") || privateIP.test(resolved_ip))
    return "DIRECT";

  /* Return nothing to check wrong output */
}