From e9d02556abb32bfe088b0dd3081d83ba11ea6f1c Mon Sep 17 00:00:00 2001 From: grepsuzette Date: Wed, 19 Feb 2025 15:12:59 +0800 Subject: [PATCH] allow a bool config to blacklist everything (except the whitelist) --- VERSION | 2 +- config.yaml | 5 ++++- src/blacklist.go | 3 +++ src/version.go | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index b37392d..79b0815 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v0.4.3 \ No newline at end of file +v0.4.4 diff --git a/config.yaml b/config.yaml index feab443..fd8f28c 100644 --- a/config.yaml +++ b/config.yaml @@ -13,6 +13,9 @@ blacklist: # Blacklist renewal interval in minutes - set to 0 to disable blacklistRenewal: 1440 +# You can also choose to blacklist everything (only whitelist will work then) +blacklistEverything: false + # Domain names to be resolved upstream, even if they are blacklisted whitelist: - googleadservices.com @@ -31,4 +34,4 @@ local: - name: service2.local target: - address: 192.168.178.2 - type: A \ No newline at end of file + type: A diff --git a/src/blacklist.go b/src/blacklist.go index 30f773a..4ea7aa8 100644 --- a/src/blacklist.go +++ b/src/blacklist.go @@ -29,6 +29,9 @@ func queryBlacklist(name string, qtype uint16) ([]dns.RR, error) { } func isBlacklisted(name string) bool { + if GetConfig().BlacklistEverything { + return true + } for _, cur := range blacklistRecords { if cur == name { return true diff --git a/src/version.go b/src/version.go index 5338cf7..e19e53b 100644 --- a/src/version.go +++ b/src/version.go @@ -1,4 +1,4 @@ // File autogenerated from VERSION, do not change manually! package main -const AppVersion = "v0.4.3" +const AppVersion = "v0.4.4"