79 lines
2.6 KiB
JavaScript
79 lines
2.6 KiB
JavaScript
function FindProxyForURL(url, host) {
|
|
var proxy = "PROXY proxy.vm:8118";
|
|
|
|
// Domains that should go through the proxy
|
|
var proxyDomains = [
|
|
"linkedin.com", "www.linkedin.com",
|
|
"rutracker.org", "*.rutracker.*",
|
|
"2ip.ru",
|
|
"kinozal.tv", "*.kinozal.tv",
|
|
"ntc.party",
|
|
"instagram.com", "*.instagram.com", "*.cdninstagram.com",
|
|
"chatgpt.com", "*.chatgpt.com", "openai.com", "*.openai.com",
|
|
"digitalocean.com", "*.digitalocean.com",
|
|
"cisco.com", "*.cisco.com",
|
|
"medium.com", "*.medium.com",
|
|
"homarr.dev", "*.homarr.dev",
|
|
"netgate.com", "*.netgate.com",
|
|
"boostymark.com", "*.boostymark.com",
|
|
"discord.com", "*.discord.com", "discord.gg", "*.discord.gg",
|
|
"notepad-plus-plus.org", "*.notepad-plus-plus.org",
|
|
"clickhouse.com", "*.clickhouse.com",
|
|
"hashicorp.com", "*.hashicorp.com",
|
|
"vagrantup.com", "*.vagrantup.com",
|
|
"vagrantcloud.com", "*.vagrantcloud.com",
|
|
"turnkeylinux.org", "*.turnkeylinux.org",
|
|
"habr.com", "*.habr.com",
|
|
"giters.com", "*.giters.com",
|
|
"imdb.com", "*.imdb.com",
|
|
"themoviedb.org", "*.themoviedb.org",
|
|
"intel.com", "*.intel.com",
|
|
"docker.com", "*.docker.com",
|
|
"i-edem.tv", "*.i-edem.tv",
|
|
"portainer.io", "*.portainer.io",
|
|
"terraform.io", "*.terraform.io"
|
|
];
|
|
|
|
var googleDomains = [
|
|
"youtube.com", "*.youtube.com", "*.youtu.be", "youtu.be",
|
|
"*.ytimg.com", "*.ggpht.com", "*.googleusercontent.com",
|
|
"*.googlevideo.com", "google.com", "*.google.com",
|
|
"*.yt.be", "yt.be", "*.l.google.com",
|
|
"jnn-pa.googleapis.com", "l.google.com"
|
|
];
|
|
|
|
// Domains that should go directly (without proxy)
|
|
var directDomains = [
|
|
"mail.google.com", "meet.google.com",
|
|
"zblv.ru", "*.zblv.ru"
|
|
];
|
|
|
|
// Function to check if host matches any pattern
|
|
function matchesAny(host, patterns) {
|
|
for (var i = 0; i < patterns.length; i++) {
|
|
if (shExpMatch(host, patterns[i])) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// Ensure anything in the `.vm` domain goes direct
|
|
if (shExpMatch(host, "*.vm") || shExpMatch(host, "zblv.ru") || shExpMatch(host, "*.zblv.ru")) {
|
|
return "DIRECT";
|
|
}
|
|
|
|
// Direct connection for specific domains
|
|
if (matchesAny(host, directDomains)) {
|
|
return "DIRECT";
|
|
}
|
|
|
|
// Proxy for matched domains
|
|
if (matchesAny(host, proxyDomains) || matchesAny(host, googleDomains)) {
|
|
return proxy;
|
|
}
|
|
|
|
// Default: no proxy
|
|
return "DIRECT";
|
|
}
|