vanadium/secure_dns: simplify blocklist management

This commit is contained in:
Primrose 2025-10-31 12:17:40 +08:00
parent 3eb030b8f4
commit 7a613e9a43
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA

View file

@ -29,41 +29,12 @@
# Blocklists are made of one pattern per line.
# https://github.com/DNSCrypt/dnscrypt-proxy/blob/fa59f990431a49b6485f63f96601bc7e64017bf8/dnscrypt-proxy/example-dnscrypt-proxy.toml#L583C4-L583C75
blocked_names.blocked_names_file = let
blocked_names.blocked_names_file = pkgs.concatText "dnsblocklist_combined" [
# Prevent building up reliance on chatbots
# Gotta preserve that thinking ability of my smoof bwain
ai_list = let
src = pkgs.fetchFromGitHub {
owner = "laylavish";
repo = "uBlockOrigin-HUGE-AI-Blocklist";
rev = "9bb188e2701138e03f73bacebd6b19b181ca0012";
hash = "sha256-p3wfR28DH6V8BHn9DT10d09Yq3mdbBecWwlR1CdDYUA=";
};
in
lib.pipe (builtins.readFile "${src}/noai_hosts.txt") [
(lib.replaceStrings ["\r\n"] ["\n"]) # convert to unix ending just in case
(lib.splitString "\n")
(builtins.filter (x: ! (x == "" || lib.hasPrefix "#" x)))
(builtins.map (x: builtins.elemAt (lib.splitString " " x) 1)) # remove 0.0.0.0
];
hategroup_list = let
src = pkgs.fetchFromGitHub {
owner = "chigh";
repo = "hategroup-dnsbl";
rev = "cc19c050997d5f54014bb20c764b131e003dfb17";
hash = "sha256-SZBrjIBUw687MdrbOV7WrP5IhAAtKvPL2GqdcICHNvQ=";
};
in
lib.pipe (builtins.readFile "${src}/blocklist.txt") [
(lib.replaceStrings ["\r\n"] ["\n"]) # convert to unix ending just in case
(lib.splitString "\n")
(builtins.filter (x: ! (x == "" || lib.hasPrefix "#" x)))
];
combined_lists = ai_list ++ hategroup_list;
in
pkgs.writeText "dnsblocklist" (builtins.concatStringsSep "\n" combined_lists);
pkgs.ai_blocklist
pkgs.hategroup_blocklist
];
# Add this to test if dnscrypt-proxy is actually used to resolve DNS requests
# query_log.file = "/var/log/dnscrypt-proxy/query.log";