From ba85d1aacf4060d7e32de20a731ca2bdad3c0a0d Mon Sep 17 00:00:00 2001 From: Brian Cunnie Date: Sat, 22 Jun 2024 14:55:27 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20Remove=20incorrect=20`-delegates?= =?UTF-8?q?`=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes, when server is started with `-delegates` unset: ``` -delegates: arguments should be in the format "delegatedDomain=nameserver", not "" ``` --- integration_flags_test.go | 2 +- xip/xip.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/integration_flags_test.go b/integration_flags_test.go index be75414..90fb14d 100644 --- a/integration_flags_test.go +++ b/integration_flags_test.go @@ -173,7 +173,7 @@ var _ = Describe("flags", func() { flags = []string{"-delegates="} }) It("should give an informative message", func() { - Expect(string(serverSession.Err.Contents())).Should(MatchRegexp(`-delegates: arguments should be in the format "delegatedDomain=nameserver", not ""`)) + Expect(string(serverSession.Err.Contents())).Should(Not(MatchRegexp(`-delegates`))) }) }) When("the arguments are mangled", func() { diff --git a/xip/xip.go b/xip/xip.go index 0087152..1677ec9 100644 --- a/xip/xip.go +++ b/xip/xip.go @@ -250,6 +250,9 @@ func NewXip(blocklistURL string, nameservers []string, addresses []string, deleg } // Parse and set the nameservers of our delegated domains for _, delegate := range delegates { + if delegate == "" { // most common case: no delegates defined + continue + } delegatedDomainAndNameserver := strings.Split(strings.ToLower(delegate), "=") if len(delegatedDomainAndNameserver) != 2 { logmessages = append(logmessages, fmt.Sprintf(`-delegates: arguments should be in the format "delegatedDomain=nameserver", not "%s"`, delegate))