代理总是失败
function FindProxyForURL( url, host )
{
url = url.toLowerCase();
host = host.toLowerCase();
if ( shExpMatch(url, "*.getlantern.org") || host == "getlantern.org"
|| shExpMatch(url, "*.getpocket.com") || host == "getpocket.com"
|| shExpMatch(url, "*.ggpht.com") || host == "ggpht.com"
|| shExpMatch(url, "*.github.com") || host == "github.com"
|| shExpMatch(url, "*.github.io") || host == "github.io"
|| shExpMatch(url, "*.githubusercontent.com") || host == "githubusercontent.com"
|| shExpMatch(url, "*.gitlab.com") || host == "gitlab.com"
|| shExpMatch(url, "*.gmail.com") || host == "gmail.com"
|| shExpMatch(url, "*.goo.gl") || host == "goo.gl"
|| shExpMatch(url, "*.google-analytics.com") || host == "google-analytics.com"
|| shExpMatch(url, "*.google.com") || host == "google.com"
|| shExpMatch(url, "*.googleapis.com") || host == "googleapis.com"
|| shExpMatch(url, "*.googlesyndication.com") || host == "googlesyndication.com"
|| shExpMatch(url, "*.googleusercontent.com") || host == "googleusercontent.com"
|| shExpMatch(url, "*.googlevideo.com") || host == "googlevideo.com" )
{
return "SOCKS5 127.0.0.1:8016";
}
else
{
return "DIRECT";
}
}
1
SoloCompany 2016-04-04 15:45:57 +08:00
为啥用 shExpMatch
正则语法不是像你这样的,你那个叫 glob pattern 直接用 host.endsWith 呗 啥? js 没有这个函数? 那就写一个呗 |
2
rungo OP @SoloCompany shExpMatch 不是用的正则表达四,是 shell expression,就是通配符,这一点没问题
|
3
rungo OP 找到原因了, pac 写的没问题,只是我用 shadowsocks 搭的代理应该把` return "SOCKS5 127.0.0.1:8016";` 改成 ` return "SOCKS5 127.0.0.1:8016; SOCKS 127.0.0.1:8016";`
|
4
rungo OP 找到原因了, pac 写的没问题,只是我用 shadowsocks 搭的代理应该把
``` return "SOCKS5 127.0.0.1:8016"; ``` 改成 ``` return "SOCKS5 127.0.0.1:8016; SOCKS 127.0.0.1:8016"; ``` |
5
rungo OP 找到原因了, pac 写的没问题,只是我用 shadowsocks 搭的代理应该把
``` return "SOCKS5 127.0.0.1:8016"; ``` 改成 ```return "SOCKS5 127.0.0.1:8016; SOCKS 127.0.0.1:8016"; ``` |