From 1b8fdbeb84d17990b68975791154784b5501b150 Mon Sep 17 00:00:00 2001 From: Anton Z Date: Fri, 31 Jan 2025 15:30:30 +0300 Subject: [PATCH] rewrite proxy --- proxy.pac | 276 +++++++++++------------------------------------------- 1 file changed, 53 insertions(+), 223 deletions(-) diff --git a/proxy.pac b/proxy.pac index f23daeb..2a70a07 100644 --- a/proxy.pac +++ b/proxy.pac @@ -1,224 +1,54 @@ function FindProxyForURL(url, host) { - -//Linkedin domains - if ((shExpMatch(host, "linkedin.com")) || - (shExpMatch(host, "www.linkedin.com"))) - { return "PROXY proxy.vm:8118" } - -else -//rutracker.org - - if ((shExpMatch(host, "rutracker.org")) || - (shExpMatch(host, "*.rutracker.*"))) - { return "PROXY proxy.vm:8118"} -else -//2ip.ru - -if (shExpMatch(host, "2ip.ru")) -{ return "PROXY proxy.vm:8118"} -else - -//kinozal.tv - - if ((shExpMatch(host, "kinozal.tv")) || - (shExpMatch(host, "*.kinozal.tv"))) - { return "PROXY proxy.vm:8118"} -else -//ntc.party - - if (shExpMatch(host, "ntc.party")) - { return "PROXY proxy.vm:8118"} - -else -//instagram - - if ((shExpMatch(host, "*.instagram.com")) || - (shExpMatch(host, "instagram.com")) || - (shExpMatch(host, "*.cdninstagram.com"))) - { return "PROXY proxy.vm:8118"} - -else -//youtube - - if ((shExpMatch(host, "youtube.com")) || - (shExpMatch(host, "*.youtube.com")) || - (shExpMatch(host, "*.youtu.be")) || - (shExpMatch(host, "youtu.be")) || - (shExpMatch(host, "*.ytimg.com")) || - (shExpMatch(host, "*.ggpht.com")) || - (shExpMatch(host, "*.googleusercontent.com")) || - (shExpMatch(host, "*.googlevideo.com")) || - (shExpMatch(host, "google.com")) || - (shExpMatch(host, "*.google.com")) || - (shExpMatch(host, "*.yt.be")) || - (shExpMatch(host, "yt.be")) || - (shExpMatch(host, "*.l.google.com")) || - (shExpMatch(host, "jnn-pa.googleapis.com")) || - (shExpMatch(host, "l.google.com"))) - { return "PROXY proxy.vm:8118"} - - -else -//chatgpt - - if ((shExpMatch(host, "chatgpt.com")) || - (shExpMatch(host, "openai.com")) || - (shExpMatch(host, "*.openai.com")) || - (shExpMatch(host, "*.chatgpt.com"))) - { return "PROXY proxy.vm:8118"} - -else - -//digitalocean.com - -if ((shExpMatch(host, "digitalocean.com")) || -(shExpMatch(host, "*.digitalocean.com"))) -{ return "PROXY proxy.vm:8118"} - -else - - - -//cisco - - if ((shExpMatch(host, "cisco.com")) || - (shExpMatch(host, "*.cisco.com"))) - { return "PROXY proxy.vm:8118"} - -else - -//medium - - if ((shExpMatch(host, "medium.com")) || - (shExpMatch(host, "*.medium.com"))) - { return "PROXY proxy.vm:8118"} - -else - -//homarr - - if ((shExpMatch(host, "homarr.dev")) || - (shExpMatch(host, "*.homarr.dev"))) - { return "PROXY proxy.vm:8118"} - -else - -//netgate - - if ((shExpMatch(host, "netgate.com")) || - (shExpMatch(host, "*.netgate.com")) || - (shExpMatch(host, "boostymark.com")) || - (shExpMatch(host, "*.boostymark.com"))) - { return "PROXY proxy.vm:8118"} - -else - -//discord - - if ((shExpMatch(host, "discord.com")) || - (shExpMatch(host, "*.discord.com")) || - (shExpMatch(host, "discord.gg")) || - (shExpMatch(host, "*.discord.gg"))) - { return "PROXY proxy.vm:8118"} - -else - -//notepad-plus-plus.org - - if ((shExpMatch(host, "notepad-plus-plus.org")) || - (shExpMatch(host, "*.notepad-plus-plus.org"))) - { return "PROXY proxy.vm:8118"} - -else - -//clickhouse - -if ((shExpMatch(host, "clickhouse.com")) || -(shExpMatch(host, "*.clickhouse.com"))) -{ return "PROXY proxy.vm:8118"} - -else - -//vagrant - -if ((shExpMatch(host, "hashicorp.com")) || -(shExpMatch(host, "*.hashicorp.com")) || -(shExpMatch(host, "vagrantup.com")) || -(shExpMatch(host, "*.vagrantup.com")) || -(shExpMatch(host, "vagrantcloud.com")) || -(shExpMatch(host, "*.vagrantcloud.com"))) -{ return "PROXY proxy.vm:8118"} - -else - -//turnkey - -if ((shExpMatch(host, "turnkeylinux.org")) || -(shExpMatch(host, "*.turnkeylinux.org"))) -{ return "PROXY proxy.vm:8118"} -else - -//habr - -if ((shExpMatch(host, "habr.com")) || -(shExpMatch(host, "*.habr.com"))) -{ return "PROXY proxy.vm:8118"} - -else - -//giters - -if ((shExpMatch(host, "giters.com")) || -(shExpMatch(host, "*.giters.com"))) -{ return "PROXY proxy.vm:8118"} - - -else - -//IMDB - -if ((shExpMatch(host, "imdb.com")) || -(shExpMatch(host, "*.imdb.com"))) -{ return "PROXY proxy.vm:8118"} - -else - -//TMDB - -if ((shExpMatch(host, "themoviedb.org")) || -(shExpMatch(host, "*.themoviedb.org"))) -{ return "PROXY proxy.vm:8118"} - - -else - -//intel - - if ((shExpMatch(host, "intel.com")) || - (shExpMatch(host, "*.intel.com"))) - { return "PROXY proxy.vm:8118"} - -else - -//terraform - -if ((shExpMatch(host, "terraform.io")) || -(shExpMatch(host, "*.terraform.io"))) -{ return "PROXY proxy.vm:8118"} - -else - -//Direct for mail.google.com and meet.google.com - - if ((shExpMatch(host, "mail.google.com")) || - (shExpMatch(host, "meet.google.com"))) - { return "DIRECT"} - -else - - -{ // Default: no proxy, -return "DIRECT" } -// End of PAC file -} -//test + var proxy = "PROXY proxy.vm:8118"; + + var proxyDomains = { + "linkedin.com": 1, + "rutracker.org": 1, "*.rutracker.*": 1, + "2ip.ru": 1, + "kinozal.tv": 1, "*.kinozal.tv": 1, + "ntc.party": 1, + "instagram.com": 1, "*.instagram.com": 1, "*.cdninstagram.com": 1, + "chatgpt.com": 1, "openai.com": 1, "*.openai.com": 1, "*.chatgpt.com": 1, + "digitalocean.com": 1, "*.digitalocean.com": 1, + "cisco.com": 1, "*.cisco.com": 1, + "medium.com": 1, "*.medium.com": 1, + "homarr.dev": 1, "*.homarr.dev": 1, + "netgate.com": 1, "*.netgate.com": 1, + "boostymark.com": 1, "*.boostymark.com": 1, + "discord.com": 1, "*.discord.com": 1, "discord.gg": 1, "*.discord.gg": 1, + "notepad-plus-plus.org": 1, "*.notepad-plus-plus.org": 1, + "clickhouse.com": 1, "*.clickhouse.com": 1, + "hashicorp.com": 1, "*.hashicorp.com": 1, + "vagrantup.com": 1, "*.vagrantup.com": 1, + "vagrantcloud.com": 1, "*.vagrantcloud.com": 1, + "turnkeylinux.org": 1, "*.turnkeylinux.org": 1, + "habr.com": 1, "*.habr.com": 1, + "giters.com": 1, "*.giters.com": 1, + "imdb.com": 1, "*.imdb.com": 1, + "themoviedb.org": 1, "*.themoviedb.org": 1, + "intel.com": 1, "*.intel.com": 1, + "terraform.io": 1, "*.terraform.io": 1 + }; + + 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" + ]; + + // Check if the host matches any proxy domain + if (proxyDomains[host] || googleDomains.some(pattern => shExpMatch(host, pattern))) { + return proxy; + } + + // Direct connection for specific Google services + if (shExpMatch(host, "mail.google.com") || shExpMatch(host, "meet.google.com")) { + return "DIRECT"; + } + + // Default: no proxy + return "DIRECT"; + } + \ No newline at end of file