Skip to content

Instantly share code, notes, and snippets.

@amiraliakbari
Last active September 16, 2017 06:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amiraliakbari/67e91d6df60ce3fb14737f5cbfc3f7db to your computer and use it in GitHub Desktop.
Save amiraliakbari/67e91d6df60ce3fb14737f5cbfc3f7db to your computer and use it in GitHub Desktop.
Proxy Auto Configuration
/**
* 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