Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ircfspace/9c22a11117f4f59a1354ff30fc51df90 to your computer and use it in GitHub Desktop.
Save ircfspace/9c22a11117f4f59a1354ff30fc51df90 to your computer and use it in GitHub Desktop.
var FindProxyForURL = function(init, profiles) {
return function(url, host) {
"use strict";
var result = init, scheme = url.substr(0, url.indexOf(":"));
do {
result = profiles[result];
if (typeof result === "function") result = result(url, host, scheme);
} while (typeof result !== "string" || result.charCodeAt(0) === 43);
return result;
};
}("+proxy", {
"+proxy": function(url, host, scheme) {
"use strict";
if (/^127\.0\.0\.1$/.test(host) || /^::1$/.test(host) || /^localhost$/.test(host)) return "DIRECT";
return "SOCKS5 127.0.0.1:8086; SOCKS 127.0.0.1:8086";
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment