notracking / hosts-blocklists

Automatically updated, moderated and optimized lists for blocking ads, trackers, malware and other garbage
2.31k stars 146 forks source link

Unbound.conf size optimization suggestion #849

Closed HuKoTuH closed 1 year ago

HuKoTuH commented 1 year ago

Hi. Seems it's my first comment on github, so sorry if something I'm doing wrong.

I have a suggestion about unbound conf file size optimization: for each domain you are using 2 lines with redirect and 0 IP address, but instead of this you can use only one line with "always_refuse" parameter.

Example: Your config:

local-zone: "0--0.gq." redirect
local-data: "0--0.gq. IN A 0.0.0.0"

What I'm doing with this on my Raspberry Pi to decrease file size and speedup the unbound daemon restart:

local-zone: "0--0.gq." always_refuse

So my file size after this is only 16M and all works fine.

Hope this will help, Regards, HuKoTuH

alvosec commented 1 year ago

Just wanted to suggest that, either to put always_refuse or always_nxdomain.

hagezi commented 1 year ago

Convert adblock format to unbound:

cat <"$header" >"$unbound"
echo "server:" >>"$unbound"
cat <"$adblock" | grep -Ev '^\s*$|^#|^!' | sed 's/||//' | sed 's/[\^]//g' | awk '{print "local-zone: \""$1".\" always_nxdomain"}' >>"$unbound"
notracking commented 1 year ago

Yes, just fixed this! Thanks. Changed format to local-zone: "0--0.ml." always_null