forked from affordablemobiles/squid-mtls-relay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproxy.pac
38 lines (29 loc) · 812 Bytes
/
proxy.pac
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
38
function FindProxyForURL(url, host) {
var direct = 'DIRECT';
var unauthenticated = 'PROXY 172.16.2.1:3128';
var proxy = 'HTTPS proxy.example.com:443';
var proxyList = {
'example.local': 1
};
var proxySpecificList = {
'dl.google.com ': 1,
'dl-ssl.google.com': 1
};
if (isPlainHostName(host)||
host === '127.0.0.1'||
host === 'localhost') {
return direct;
}
if (proxySpecificList.hasOwnProperty(host)) {
return unauthenticated;
}
var pos = host.lastIndexOf('.') + 1;
do {
hostStr = host.substring(pos);
if (proxyList.hasOwnProperty(hostStr)) {
return direct;
}
pos = host.lastIndexOf('.', pos - 2) + 1;
} while (hostStr != host);
return proxy;
}