From 1f093b30e197fba085b183cc8e5290da9cb0b854 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Thu, 17 Dec 2020 11:10:31 +0100 Subject: [PATCH] Make adding OpenNIC TLDs optional Signed-off-by: Knut Ahlers --- main.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 127b100..0a3f2c7 100644 --- a/main.go +++ b/main.go @@ -17,6 +17,7 @@ import ( var ( cfg = struct { ConcurrencyLimit int `flag:"concurrency-limit" default:"50" description:"How many queries to execute in parallel"` + EnableOpenNIC bool `flag:"enable-opennic" vardefault:"enable-opennic" description:"Enable adding OpenNIC TLDs"` IANATldList string `flag:"iana-tld-list" vardefault:"iana-tld-list" description:"IANA TLD list file"` IANAFilter []string `flag:"iana-filter" vardefault:"iana-filter" description:"IANA TLDs to igore"` InternicRootFile string `flag:"internic-root-file" vardefault:"internic-root" description:"Internic root nameserver file"` @@ -42,6 +43,7 @@ zone "{{ $tld }}" in { func init() { rconfig.SetVariableDefaults(map[string]string{ + "enable-opennic": "false", "iana-filter": strings.Join([]string{"arpa."}, ","), "iana-tld-list": "https://data.iana.org/TLD/tlds-alpha-by-domain.txt", "internic-root": "https://www.internic.net/domain/named.root", @@ -85,12 +87,14 @@ func main() { } setRootsFromTLDs(rootServers, rootServersMutex, ianaTLDs, cfg.IANAFilter, getIANAZoneMasters, wg, cLimiter) - // Fetch OpenNIC TLDs - opennicTLDs, err := getOpenNICTLDs() - if err != nil { - log.WithError(err).Fatal("Unable to retrieve OpenNIC TLDs") + if cfg.EnableOpenNIC { + // Fetch OpenNIC TLDs + opennicTLDs, err := getOpenNICTLDs() + if err != nil { + log.WithError(err).Fatal("Unable to retrieve OpenNIC TLDs") + } + setRootsFromTLDs(rootServers, rootServersMutex, opennicTLDs, cfg.OpenNICFilter, getOpenNICZoneMasters, wg, cLimiter) } - setRootsFromTLDs(rootServers, rootServersMutex, opennicTLDs, cfg.OpenNICFilter, getOpenNICZoneMasters, wg, cLimiter) wg.Wait()