3

I'm trying to create a simple PAC file for blocking internet baddies. I found a nice list I would like to use, but I have no coding knowledge at all. This is what I have so far:

    function FindProxyForURL(url, host) {
var normal = "DIRECT";
var proxy = "DIRECT";                  // e.g. 127.0.0.1:3128
var blackhole_ip_port = "127.0.0.1:8119";    // on iOS a working blackhole requires return code 200;
var blackhole = "PROXY " + blackhole_ip_port;
var hosts = "https://raw.githubusercontent.com/notracking/hosts-blocklists/master/dnscrypt-proxy/dnscrypt-proxy.blacklist.txt"
hosts.forEach(function(data) {
    var x = document.createElement('hosts');
    x.src = data;
    document.getElementsByTagName("body")[0].appendChild(x);
});
    
if shExpMatch(host, "hosts")
   return blackhole;

if {
   isPlainHostName(host) ||
   shExpMatch(host, "10.*") ||
   shExpMatch(host, "172.16.*") ||
   shExpMatch(host, "192.168.*") ||
   shExpMatch(host, "127.*") ||
   dnsDomainIs(host, ".LOCAL") ||
   dnsDomainIs(host, ".local")
}
        return "DIRECT";
else
        return FindProxyForURL(url, host);
}
Gorstak
  • 31
  • 1

0 Answers0