1
0
Fork 0
mirror of https://github.com/Luzifer/rootzone.git synced 2024-12-20 11:21:19 +00:00

Make adding OpenNIC TLDs optional

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2020-12-17 11:10:31 +01:00
parent d3afcf5cb1
commit 1f093b30e1
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D

14
main.go
View file

@ -17,6 +17,7 @@ import (
var ( var (
cfg = struct { cfg = struct {
ConcurrencyLimit int `flag:"concurrency-limit" default:"50" description:"How many queries to execute in parallel"` 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"` 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"` 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"` InternicRootFile string `flag:"internic-root-file" vardefault:"internic-root" description:"Internic root nameserver file"`
@ -42,6 +43,7 @@ zone "{{ $tld }}" in {
func init() { func init() {
rconfig.SetVariableDefaults(map[string]string{ rconfig.SetVariableDefaults(map[string]string{
"enable-opennic": "false",
"iana-filter": strings.Join([]string{"arpa."}, ","), "iana-filter": strings.Join([]string{"arpa."}, ","),
"iana-tld-list": "https://data.iana.org/TLD/tlds-alpha-by-domain.txt", "iana-tld-list": "https://data.iana.org/TLD/tlds-alpha-by-domain.txt",
"internic-root": "https://www.internic.net/domain/named.root", "internic-root": "https://www.internic.net/domain/named.root",
@ -85,12 +87,14 @@ func main() {
} }
setRootsFromTLDs(rootServers, rootServersMutex, ianaTLDs, cfg.IANAFilter, getIANAZoneMasters, wg, cLimiter) setRootsFromTLDs(rootServers, rootServersMutex, ianaTLDs, cfg.IANAFilter, getIANAZoneMasters, wg, cLimiter)
// Fetch OpenNIC TLDs if cfg.EnableOpenNIC {
opennicTLDs, err := getOpenNICTLDs() // Fetch OpenNIC TLDs
if err != nil { opennicTLDs, err := getOpenNICTLDs()
log.WithError(err).Fatal("Unable to retrieve OpenNIC TLDs") 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() wg.Wait()