vanadium/connectivity: dns block ai sites

This commit is contained in:
Primrose 2025-10-22 20:29:48 +08:00
parent ab5e9e8abf
commit 6c6d4ec13a
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA

View file

@ -165,6 +165,31 @@
lb_strategy = "p2";
lb_estimator = true;
# Prevent building up reliance on chatbots
# Gotta preserve that thinking ability of my smoof bwain
blocked_names = {
blocked_names_file = let
ai-blocklist =
pkgs.fetchFromGitHub {
owner = "laylavish";
repo = "uBlockOrigin-HUGE-AI-Blocklist";
rev = "f63645250fbd982b8a6ebc9b384e7dbbc37d174c";
hash = "sha256-nuZnU+CJYdN8dR7yC8Zq13C8MgBYwZZdyQEFeSMUQkA=";
}
+ "/noai_hosts.txt";
# 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 = lib.pipe (builtins.readFile ai-blocklist) [
(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
];
in
pkgs.writeText "no-ai-blocklist" (builtins.concatStringsSep "\n" blocked_names);
};
# Add this to test if dnscrypt-proxy is actually used to resolve DNS requests
# query_log.file = "/var/log/dnscrypt-proxy/query.log";
sources.public-resolvers = {