Skip to content

Instantly share code, notes, and snippets.

@neekey
Created July 31, 2012 05:19
Show Gist options
  • Save neekey/3213943 to your computer and use it in GitHub Desktop.
Save neekey/3213943 to your computer and use it in GitHub Desktop.
翻墙代理规则
function regExpMatch(url, pattern) {
try { return new RegExp(pattern).test(url); } catch(ex) { return false; }
}
function FindProxyForURL(url, host) {
if (shExpMatch(url, "*://*.google.com/*") || shExpMatch(url, "*://google.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://*.google.com.*/*") || shExpMatch(url, "*://google.com.*/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://*.google-analytics.com/*") || shExpMatch(url, "*://google-analytics.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://*.googleapis.com/*") || shExpMatch(url, "*://googleapis.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://*.googlecode.com/*") || shExpMatch(url, "*://googlecode.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://*.googleusercontent.com/*") || shExpMatch(url, "*://googleusercontent.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://*.gstatic.com/*") || shExpMatch(url, "*://gstatic.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://nodejs.org/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://hotgaylist.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*:/*.onlydudes.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://*.addthis.com/*") || shExpMatch(url, "*://addthis.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://www.hotgaylist.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://docs.appcelerator.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://www.mongodb.org//*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://docs.sencha.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://secure.gravatar.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://git-scm.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://my.appcelerator.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://maps.google.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://www.jqmobi.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://subversion.tigris.org/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://rapidshare.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://blog.gslin.org/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://twitter.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://www.amyeditor.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://www.mightydeals.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://www.flickr.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://open.login.yahoo.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://login.yahoo.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://goo.gl/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://t.co/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://*.twimg.com/*") || shExpMatch(url, "*://twimg.com/*")) return 'PROXY 127.0.0.1:8087';
if (shExpMatch(url, "*://*.wikipedia.org/*") || shExpMatch(url, "*://wikipedia.org/*")) return 'PROXY 127.0.0.1:8087';
return 'DIRECT';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment