Skip to content

Instantly share code, notes, and snippets.

@hzqtc
Created May 18, 2013 06:23
Show Gist options
  • Save hzqtc/5603458 to your computer and use it in GitHub Desktop.
Save hzqtc/5603458 to your computer and use it in GitHub Desktop.
My proxy rules.
function doesHostNeedProxy(host) {
var blocked = [
// twitter
'twitter.com',
// google sites
'feeds.feedburner.com',
'feedproxy.google.com',
'googlecode.com',
'plus.google.com',
'drive.google.com',
'blogger.com',
'blogspot.com',
'appspot.com',
// shorten url sites
'goo.gl',
'bit.ly',
't.co',
'j.mp',
'fb.me',
// common sites
'upload.wikimedia.org',
'wikia.com',
'nytimes.com',
'bloomberg.com',
'sf.net',
'autoproxy.org',
'slideshare.net',
'wordpress.com',
'git-scm.com',
'sublimetext.com',
'vimeo.com',
'mitbbs.com',
'se.itunes.apple.com',
'cocoapods.org',
'dropbox.com',
'feedbooks.net',
'torrentkitty.com',
// youtube
'youtube.com',
'youtube-nocookie.com',
'ytimg.com',
// facebook
'facebook.com',
'akamaihd.net',
// cdn and image
's3.amazonaws.com',
'instagram.com',
'pics.dmm.co.jp',
'imagebam.com',
'imgur.com',
'imgbox.com',
'images.craigslist.org',
'sadpanda.us',
];
for (var i = 0; i < blocked.length; i++) {
if (dnsDomainIs(host, blocked[i])) {
return true;
}
}
return false;
}
function FindProxyForURL(url, host) {
var PROXY = 'SOCKS5 127.0.0.1:7127; SOCKS 127.0.0.1:7127';
var DIRECT = 'DIRECT';
if (doesHostNeedProxy(host)) {
//alert('[+] ' + host);
return PROXY;
}
else {
//alert('[-] ' + host);
return DIRECT;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment