Last active
September 16, 2017 06:54
-
-
Save amiraliakbari/67e91d6df60ce3fb14737f5cbfc3f7db to your computer and use it in GitHub Desktop.
Proxy Auto Configuration
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
/** | |
* Proxy auto configuration file for accessing sites blocked in Iran due to | |
* sanctons or filtering. To use, a socks5 proxy must be running and accessible | |
* on localhost port 1080. Set url of this gist in "Automatic proxy configuration URL" | |
* field in "Network Proxy Settings" in Firefox. | |
*/ | |
function FindProxyForURL(url, host) { | |
var blockedHosts = [ | |
'twitter.com', 'twimg.com', // Twitter | |
'.youtube.com', '.ytimg.com', '.googlevideo.com', '.ggpht.com', // YouTube | |
'.firebaseio.com', // Firebase | |
'.bbc.com', '.bbc.co.uk', '.bbci.co.uk', // BBC | |
'medium.com', // Medium | |
'hacks.mozilla.org', 'blog.mozilla.org', // Tech Sites | |
'.netdna-ssl.com', // CDNs | |
'.keycdn.com', // Other Sites 1 | |
]; | |
for (var i=0; i<blockedHosts.length; i++) { | |
if (host.indexOf(blockedHosts[i]) >= 0) | |
return "SOCKS5 127.0.0.1:1080"; | |
} | |
return "DIRECT"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment