Last active
August 29, 2015 14:05
-
-
Save shiny/21aeb7fe50551645ca8d to your computer and use it in GitHub Desktop.
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
var proxy = "SOCKS5 127.0.0.1:1081; SOCKS 127.0.0.1:1081; DIRECT;"; | |
var direct = 'DIRECT;'; | |
var domains = [ | |
'twitter.com', | |
'google.com', | |
'google.com.hk', | |
't.co', | |
'twimg.com', | |
'github.com', | |
'atom.io', | |
'googleapis.com', | |
'amazonaws.com', | |
'google.com.sg', | |
'facebook.com', | |
'gstatic.com', | |
'googleusercontent.com', | |
'shadowsocks.org', | |
'youtube.com', | |
'ytimg.com', | |
'googlevideo.com', | |
'micmap.org', | |
'bit.ly', | |
'archive.org', | |
'hhvm.com', | |
'tw', | |
'jp', | |
'appspot.com', | |
'goo.gl', | |
'nytimes.com', | |
'dropbox.com', | |
'mongodb.org', | |
'pixnet.net', | |
'flickr.com', | |
'openwrt.org', | |
'slideshare.net', | |
'cloudflare.com', | |
'bbc.co.uk', | |
'golang.org' | |
]; | |
function FindProxyForURL(url, host) { | |
var i; | |
if (isPlainHostName(host)) { | |
return direct; | |
} | |
for (i=domains.length-1; i>=0; i--) { | |
if(host===domains[i] || dnsDomainIs(host, '.'+domains[i])){ | |
return proxy; | |
} | |
} | |
return direct; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment