diff --git a/cmd/bind/cleanup.go b/cmd/bind/cleanup.go index 2889d7e..71665b2 100644 --- a/cmd/bind/cleanup.go +++ b/cmd/bind/cleanup.go @@ -40,7 +40,9 @@ func cleanBadDomains(domains []string) []string { for i, allowedItem := range config.Config.AllowLists { log.Printf("[DEBUG] Processing %d of %d\n", i+1, len(config.Config.AllowLists)) - for k, v := range domains { + + list = []string{} + for _, v := range domains { r, err := regexp.Compile(allowedItem) if err != nil { log.Printf("[ERROR] Allow list item (%s) is not valid regex: %v\n", allowedItem, err) @@ -48,9 +50,11 @@ func cleanBadDomains(domains []string) []string { } if r.MatchString(v) { log.Printf("[DEBUG] Removing allowed matching item: %s\n", v) - domains = removeStringFromSlice(domains, k) + } else { + list = append(list, v) } } + domains = list } log.Printf("[INFO] Allowed hosts removed: %d\n", total-len(domains))