-
Notifications
You must be signed in to change notification settings - Fork 2
/
auto.pac
66 lines (57 loc) · 1.72 KB
/
auto.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// 1.
// iWebPP.io vURL will go through proxy
// both vHost and vPath
var regex_vboth = /((([0-9]|[a-f]){32}-)*([0-9]|[a-f]){32}\.vurl\.)|(\/vurl\/([0-9]|[a-f]){32}(-([0-9]|[a-f]){32})*)/;
// 2.
// HTTPP(http over udt over udp) enabled sites
var httpp_sites = [
'iwebpp.com',
'ruyier.com',
'51dese.com',
'anyany.me',
'cloudgua.com',
];
function checkHttpp(url, host) {
for (var i = 0; i < httpp_sites.length; i ++) {
if (host && host.match(httpp_sites[i])) return true;
if (url && url.match(httpp_sites[i])) return true;
}
return false;
}
function FindProxyForURL(url, host) {
// 1.
// check iWebPP.io vURL sites
if (url.match(regex_vboth)) {
// ftp site prefer socks5 proxy
if (url.match("ftp:")) {
return "SOCKS5 127.0.0.1:socks_port;";
}
// http/ws site prefer socks5 proxy
if (url.match("http:") || url.match("ws:")) {
return "SOCKS5 127.0.0.1:socks_port;PROXY 127.0.0.1:proxy_port;";
}
// https/wss site prefer http proxy
if (url.match("https:") || url.match("wss:")) {
return "PROXY 127.0.0.1:proxy_port;SOCKS5 127.0.0.1:socks_port;";
}
} else {
// 2.
// check httpp enabled sites
if (checkHttpp(url, host)) {
// ftp site prefer socks5 proxy
if (url.match("ftp:")) {
return "SOCKS5 127.0.0.1:socks_httpp_port;";
}
// http/ws site prefer socks5 proxy
if (url.match("http:") || url.match("ws:")) {
return "SOCKS5 127.0.0.1:socks_httpp_port;PROXY 127.0.0.1:proxy_httpp_port;";
}
// https/wss site prefer http proxy
if (url.match("https:") || url.match("wss:")) {
return "PROXY 127.0.0.1:proxy_httpp_port;SOCKS5 127.0.0.1:socks_httpp_port;";
}
} else {
return "DIRECT";
}
}
}