Last active
September 16, 2015 07:33
-
-
Save luginbash/fe9e07d1159678f444a2 to your computer and use it in GitHub Desktop.
my auto proxy configuration script, address stripped.
This file contains hidden or 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
function FindProxyForURL(url, host) { | |
// Apple Device compatibility, they will skip SOCKS5 for SOCKS. | |
var local_address = "192.168.88.0"; | |
var local_subnet = "255.255.255.0"; | |
var PROXY = "SOCKS5 __ADDRESS__:__PORT__; SOCKS __ADDRESS__:__PORT__"; | |
var OLDMILL = "SOCKS5 __ADDRESS__:__PORT__; SOCKS __ADDRESS__:__PORT__"; | |
var domain_list = [ ".ytimg.com" | |
,".youtube.com" | |
,".greatfire.org" | |
,"gist.github.com" | |
,".panoramio.com" | |
,".google.co.jp" | |
,".goo.gl" | |
,"goo.gl" | |
,".android.com" | |
,".chromium.org" | |
,".googlelabs.com" | |
,"..googlesource.com" | |
,".xkcd.com" | |
,".imgur.com" | |
,"imgur.com" | |
,".vimeo.com" | |
,".wikipedia.org" | |
,".wikia.com" | |
,".uncyclopedia.org" | |
,".googlevideo.com" | |
,".googlesyndication.com" | |
,".doubleclick.net" // good faith | |
,".googleadservices.com" | |
,".ggpht.com" | |
,".appspot.com" | |
,".googleapis.com" | |
,".clients.google.com" | |
,".instagram.com" | |
,"instagram.com" | |
,".googlecode.com" | |
,".googlehosted.com" | |
,".googleusercontent.com" | |
,".googleapis.com" | |
,".blogspot.com" | |
,".blogspot.jp" | |
,".blogger.com" | |
,".feedburner.com" | |
,".blogger.jp" | |
,".blogblog.com" | |
,".akamaihd.net" | |
,".nytimes.com" | |
,".bbc.co.uk" | |
,".newyorker.com" | |
,".theguardian.com" | |
,".soundcloud.com" | |
,".wp.com" | |
,".wordpress.com" | |
,".openvpn.net" | |
,".duckduckgo.com" | |
,".archive.org" | |
,".wsj.net" | |
,".businessinsider.com/" | |
,".wsj.com" | |
,"s3.amazonaws.com" | |
,".e.akamai.net" | |
,".edgecastcdn.net" | |
,"fbstatic-a.akamaihd.net" | |
,".bloomberg.com" | |
,".facebook.com" | |
,".facebook.net" | |
,".fbcdn.net" | |
,".twimg.net" | |
,".twimg.com" | |
,".twitter.com" | |
,"twitter.com" | |
,".edgecastcdn.net" | |
,".sstatic.net" | |
,".gstatic.net" | |
,".gstatic.com" | |
,".nianticproject.com" | |
,".ingress.com" | |
,".1e100.net" | |
,".dropbox.com" | |
,".typekit.net" | |
,".google.com"]; | |
// Oldmill LAN | |
if (isInNet(myIpAddress(), local_address, local_subnet)) | |
PROXY = OLDMILL; | |
if (isPlainHostName(host) || | |
shExpMatch(host, "*.local") || | |
isInNet(dnsResolve(host), "10.0.0.0", "255.0.0.0") || | |
isInNet(dnsResolve(host), "172.16.0.0", "255.240.0.0") || | |
isInNet(dnsResolve(host), "192.168.0.0", "255.255.0.0") || | |
isInNet(dnsResolve(host), "159.226.0.0", "255.255.0.0") || | |
isInNet(dnsResolve(host), "127.0.0.0", "255.255.255.0")) | |
return "DIRECT"; | |
// Main::Proxy | |
for (var i = domain_list.length - 1; i >= 0; i--){ | |
if (dnsDomainIs(host, domain_list[i])) {return PROXY} | |
}; | |
// default to no Proxy | |
return "DIRECT"; | |
} | |
/* | |
Copyright (c) Quan Zhou | |
THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED | |
OR IMPLIED. ANY USE IS AT YOUR OWN RISK. | |
Permission is hereby granted to use or copy this program | |
for any purpose, provided the above notices are retained on all copies. | |
Permission to modify the code and to distribute modified code is granted, | |
provided the above notices are retained, and a notice that the code was | |
modified is included with the above copyright notice. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment