Debian Codegraph @

tests/data/px-manager-sample.pac

raw
1 function FindProxyForURL(url, host)
2 {
3 var resolved_ip = dnsResolve(host);
4 var myIP = myIpAddress();
5 var privateIP = /^(0|10|127|192\.168|172\.1[6789]|172\.2[0-9]|172\.3[01]|169\.254|192\.88\.99)\.[0-9.]+$/;
6
7 if (shExpMatch(host, "192.168.10.4"))
8 return "SOCKS 127.0.0.1:1983"
9
10 if (dnsDomainIs(host, "192.168.10.5"))
11 return "SOCKS4 127.0.0.1:1983"
12
13 if (dnsDomainIs(host, "192.168.10.6"))
14 return "SOCKS4A 127.0.0.1:1983"
15
16 if (dnsDomainIs(host, "192.168.10.7"))
17 return "SOCKS5 127.0.0.1:1983"
18
19 /* Invalid return */
20 if (dnsDomainIs(host, "192.168.10.8"))
21 return "PROXY %%"
22
23 /* Invalid return */
24 if (dnsDomainIs(host, "192.168.10.9"))
25 return "INVALID"
26
27 alert("DEFAULT")
28
29 if (dnsDomainIs(host, "www.example.com"))
30 return "PROXY 127.0.0.1:1984; DIRECT"
31
32 /* Don't send non-FQDN or private IP auths to us */
33 if (isPlainHostName(host) || isInNet(resolved_ip, "192.0.2.0","255.255.255.0") || privateIP.test(resolved_ip))
34 return "DIRECT";
35
36 /* Return nothing to check wrong output */
37 }