Last active
June 16, 2019 05:53
-
-
Save ratazzi/4473819 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
<?php | |
/** | |
* 用于 Mac OS X 系统的 Automatic Proxy Configuration | |
* 因为 Firefox,Chrome 需要使用 SOCKS5 而 Safari 及其他程序只认 SOCKS,所以这样区分 | |
* 也可以简单的使用 return "SOCKS5 127.0.0.1:7777;SOCKS 127.0.0.1:7777"; 这种方式 | |
*/ | |
$proxy = 'SOCKS'; | |
$matches = array(); | |
preg_match('/(Firefox|Chrome)/', $_SERVER['HTTP_USER_AGENT'], $matches); | |
if (!empty($matches)) { | |
$proxy = 'SOCKS5'; | |
} | |
?> | |
function FindProxyForURL(url, host) | |
{ | |
var proxy = "<?php echo $proxy;?> 127.0.0.1:7777"; | |
if (shExpMatch(url, "*.wikipedia.org/*")) { return proxy; } | |
if (shExpMatch(url, "*.apple.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.dell.com.cn/*")) { return proxy; } | |
if (shExpMatch(url, "*.tumblr.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.soup.io/*")) { return proxy; } | |
if (shExpMatch(url, "*.pandora.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.last.fm/*")) { return proxy; } | |
if (shExpMatch(url, "*.adobe.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.photoshop.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.google.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.gstatic.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.google.com.hk/*")) { return proxy; } | |
if (shExpMatch(url, "*.googlecode.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.google-analytics.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.googleapis.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.googleusercontent.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.goo.gl/*")) { return proxy; } | |
if (shExpMatch(url, "*.blogspot.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.appspot.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.demonoid.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.wikimedia.org/*")) { return proxy; } | |
if (shExpMatch(url, "*.flickr.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.yahoo.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.zend.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.aptana.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.uncyclopedia.tw/*")) { return proxy; } | |
if (shExpMatch(url, "*.uncyc.org/*")) { return proxy; } | |
if (shExpMatch(url, "*.facebook.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.youtube.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.ytimg.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.webarchive.org/*")) { return proxy; } | |
if (shExpMatch(url, "*.twimg.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.rackspacecloud.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.tornadoweb.org/*")) { return proxy; } | |
if (shExpMatch(url, "*.python.org/*")) { return proxy; } | |
if (shExpMatch(url, "*.mongodb.org/*")) { return proxy; } | |
if (shExpMatch(url, "*.jivesoftware.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.feedburner.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.dropbox.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.yiiframework.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.37signal.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.blacktree.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.snippetsapp.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.codeboxapp.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.youxu.info/*")) { return proxy; } | |
if (shExpMatch(url, "*.ffmpeg.org/*")) { return proxy; } | |
if (shExpMatch(url, "*.trankynam.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.spotify.com/*")) { return proxy; } | |
if (shExpMatch(url, "*.slideshare.net/*")) { return proxy; } | |
if (dnsDomainIs(host, "twitter.com")) { return proxy; } | |
if (dnsDomainIs(host, "vimeo.com")) { return proxy; } | |
if (dnsDomainIs(host, "stackoverflow.com")) { return proxy; } | |
if (dnsDomainIs(host, "github.com")) { return proxy; } | |
if (dnsDomainIs(host, "getcloudapp.com")) { return proxy; } | |
if (dnsDomainIs(host, "img.ly")) { return proxy; } | |
if (dnsDomainIs(host, "bit.ly")) { return proxy; } | |
if (dnsDomainIs(host, "cl.ly")) { return proxy; } | |
if (dnsDomainIs(host, "who.is")) { return proxy; } | |
if (dnsDomainIs(host, "twitpic.com")) { return proxy; } | |
if (dnsDomainIs(host, "plurk.com")) { return proxy; } | |
if (dnsDomainIs(host, "foursquare.com")) { return proxy; } | |
if (dnsDomainIs(host, "thechangelog.com")) { return proxy; } | |
if (dnsDomainIs(host, "t.co")) { return proxy; } | |
if (dnsDomainIs(host, "wwwendt.de")) { return proxy; } | |
if (dnsDomainIs(host, "openerp.com")) { return proxy; } | |
return "DIRECT"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment