Last active
January 29, 2016 11:03
-
-
Save vickery/b9412ebf9977abdaa724 to your computer and use it in GitHub Desktop.
PAC示例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Your deblocus client listen address | |
var myProxy = 'socks5 127.0.0.1:9009; socks 127.0.0.1:9009; proxy 127.0.0.1:9009'; | |
// domain=1 for proxy | |
// domain=0 for direct | |
var domains = { | |
'android.com' : 1, | |
'appspot.com' : 1, | |
'blogspot.com' : 1, | |
'chrome.com' : 1, | |
'chromium.org' : 1, | |
'ggpht.com' : 1, | |
'gmail.com' : 1, | |
'golang.org' : 1, | |
'googleapis.com' : 1, | |
'fonts.googleapis.com' : 0, | |
'googlecode.com' : 1, | |
'google.com' : 1, | |
'googlegroups.com' : 1, | |
'googlesource.com' : 1, | |
'googleusercontent.com' : 1, | |
'googlevideo.com' : 1, | |
'gstatic.com' : 1, | |
'fonts.gstatic.com' : 0, | |
'gvt1.com' : 1, | |
'youtube.com' : 1, | |
'youtu.be' : 1, | |
'youtube-nocookie.com' : 1, | |
'ytimg.com' : 1, | |
'goo.gl' : 1, | |
'g.co' : 1, | |
'twitter.com' : 1, | |
'twimg.com' : 1, | |
't.co' : 1, | |
'facebook.com' : 1, | |
'fbcdn.net' : 1, | |
'fb.me' : 1, | |
'dropbox.com' : 1, | |
's3.amazonaws.com' : 1, | |
'sourceforge.net' : 1, | |
}; | |
function FindProxyForURL(url, host) { | |
if (domains.hasOwnProperty(host)) { | |
return domains[host] ? myProxy : 'direct'; | |
} | |
var suffix; | |
for (var pos = host.indexOf('.') + 1; pos; pos = host.indexOf('.', pos) + 1) { | |
suffix = host.substring(pos); | |
if (domains.hasOwnProperty(suffix)) { | |
return domains[suffix] ? myProxy : 'direct'; | |
} | |
} | |
return 'direct'; | |
} |
设置了PAC后,把代理设置为deblocus后,访问任何网站还是全走的deblocus代理,不知道为何?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
需要把第一行中的
127.0.0.1:9009
替换为自己的deblocus监听地址和端口。另外,在安卓系统设置中使用PAC时,部分应用可能不支持PAC,可能需要手动指定为HTTP Proxy。