From ed5a90ef2553bee77dfe670c5ecc8c88cfd5f9e1 Mon Sep 17 00:00:00 2001 From: "Quentin McGaw (desktop)" Date: Fri, 7 Feb 2020 14:21:26 +0000 Subject: [PATCH] Fixes #73 --- internal/params/dns.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/internal/params/dns.go b/internal/params/dns.go index 1a60e622..45a5fd26 100644 --- a/internal/params/dns.go +++ b/internal/params/dns.go @@ -62,9 +62,18 @@ func (p *paramsReader) GetDNSMaliciousBlocking() (blocking bool, err error) { } // GetDNSSurveillanceBlocking obtains if surveillance hostnames/IPs should be blocked -// from being resolved by Unbound, using the environment variable BLOCK_NSA +// from being resolved by Unbound, using the environment variable BLOCK_SURVEILLANCE +// and BLOCK_NSA for retrocompatibility func (p *paramsReader) GetDNSSurveillanceBlocking() (blocking bool, err error) { - return p.envParams.GetOnOff("BLOCK_NSA", libparams.Default("off")) + // Retro-compatibility + s, err := p.envParams.GetEnv("BLOCK_NSA") + if err != nil { + return false, err + } else if len(s) != 0 { + p.logger.Warn("You are using the old environment variable BLOCK_NSA, please consider changing it to BLOCK_SURVEILLANCE") + return p.envParams.GetOnOff("BLOCK_NSA", libparams.Compulsory()) + } + return p.envParams.GetOnOff("BLOCK_SURVEILLANCE", libparams.Default("off")) } // GetDNSAdsBlocking obtains if ads hostnames/IPs should be blocked