mirror of
https://github.com/cunnie/sslip.io.git
synced 2025-10-05 23:56:50 +08:00
🐞 Remove incorrect -delegates
warning
fixes, when server is started with `-delegates` unset: ``` -delegates: arguments should be in the format "delegatedDomain=nameserver", not "" ```
This commit is contained in:
@@ -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() {
|
||||
|
@@ -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))
|
||||
|
Reference in New Issue
Block a user