Skip to content

Instantly share code, notes, and snippets.

@mahmut-gundogdu
Last active June 26, 2019 05:40
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 mahmut-gundogdu/17c5e5fd52cddc8b51d0e0aa4214b58b to your computer and use it in GitHub Desktop.
Save mahmut-gundogdu/17c5e5fd52cddc8b51d0e0aa4214b58b to your computer and use it in GitHub Desktop.
var domains = {
"wikipedia.org":1,
"spotify.com":1
}
var proxy = "SOCKS5 127.0.0.1:1080; SOCKS 127.0.0.1:1080; DIRECT;";
var direct = 'DIRECT;';
function FindProxyForURL(url, host) {
var lastPos;
do {
if (domains.hasOwnProperty(host)) {
return proxy;
}
lastPos = host.indexOf('.') + 1;
host = host.slice(lastPos);
} while (lastPos >= 1);
return direct;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment