Created
March 3, 2015 23:22
-
-
Save martzuk/3d8edc458560055cc559 to your computer and use it in GitHub Desktop.
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
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; | |
}; | |
}("+Auto Switch", { | |
"+Auto Switch": function(url, host, scheme) { | |
"use strict"; | |
if (/broadcasthe\.net$/.test(host)) return "+lhr01"; | |
if (/passthepopcorn\.me$/.test(host)) return "+lhr01"; | |
return "DIRECT"; | |
}, | |
"+lhr01": function(url, host, scheme) { | |
"use strict"; | |
if (host === "[::1]" || host === "localhost" || host === "127.0.0.1") return "DIRECT"; | |
switch (scheme) { | |
case "http": | |
return "PROXY x.x.x:3128"; | |
default: | |
return "DIRECT"; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment