Skip to content

Instantly share code, notes, and snippets.

@zhouyl
Last active January 28, 2026 09:18
Show Gist options
  • Select an option

  • Save zhouyl/aec209965181d4e6a368 to your computer and use it in GitHub Desktop.

Select an option

Save zhouyl/aec209965181d4e6a368 to your computer and use it in GitHub Desktop.
Proxy.pac
function FindProxyForURL(url, host) {
var PROXY = "SOCKS5 10.1.2.79:8600; DIRECT;";
var DIRECT = "DIRECT";
var list = [
'*t.co*',
'*twitter.com*',
'*twimg.com*',
'*tinypic.com*',
'*twitpic.com*',
'*bitly.com*',
'*yfrog.com*',
'*youtube.com*',
'*facebook.com*',
'*appspot.com*',
'*dropbox.com*',
'*flickr.com*',
'*google.com*',
'*ggpht.com*',
'*hzmangel.info*',
'*slideshare.net*',
'*vimeo.com*',
'*wordpress.com*',
'*malsup.com*',
'*jsfiddle.net*',
'*phalconphp.com*',
'*codeplex.com*',
'*gavatar.com*',
'*github.com*',
'*github.io*'
];
for(var i=0; i<list.length; i++) {
if (shExpMatch(url, list[i])) {
return PROXY;
}
}
if (
// 主机名中没有 "."
isPlainHostName(host) ||
// 主机可解析
isResolvable(host) ||
// 如果主机在子网中
isInNet(dnsResolve(host), "10.1.0.0", "255.255.255.0") ||
isInNet(dnsResolve(host), "192.168.0.0", "255.255.255.0") ||
isInNet(dnsResolve(host), "127.0.0.0", "255.255.255.0")
) {
return DIRECT;
}
return PROXY;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment