Skip to content

Instantly share code, notes, and snippets.

@polymorphm
Last active August 29, 2015 14:03
Show Gist options
  • Save polymorphm/bfa564f3f755f9885f33 to your computer and use it in GitHub Desktop.
Save polymorphm/bfa564f3f755f9885f33 to your computer and use it in GitHub Desktop.
proxy auto-config (PAC) file -- for regular usage
// -*- mode: js; coding: utf-8 -*-
//
// ``local_proxy`` it is -- ssh -o ServerAliveInterval=60 -NfD 1080 [email protected]
//
// ``tor_proxy`` it is -- tor proxy
function FindProxyForURL (url, host) {
var local_proxy = 'SOCKS5 127.0.0.1:1080'
var tor_proxy = 'SOCKS5 127.0.0.1:9050'
if (shExpMatch(host, 'localhost') ||
shExpMatch(host, '::1') ||
shExpMatch(host, '127.*.*.*') ||
shExpMatch(host, '192.168.*.*')) {
return 'DIRECT'
}
//if (shExpMatch(url, 'https://*') &&
// shExpMatch(host, '*.wikipedia.org')) {
// return 'DIRECT'
//}
//if ((shExpMatch(url, 'https://*') || shExpMatch(url, 'http://*')) &&
// shExpMatch(host, 'store.steampowered.com')) {
// return 'DIRECT'
//}
if (shExpMatch(host, '*.onion')) {
return tor_proxy
}
return local_proxy
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment