1
0
Fork 0
mirror of https://github.com/Luzifer/named-blacklist.git synced 2024-11-08 15:30:06 +00:00

Collect comments for all sources

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2020-02-11 16:04:59 +01:00
parent 2a224984a5
commit 9d52d69430
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
2 changed files with 15 additions and 3 deletions

18
main.go
View file

@ -4,6 +4,7 @@ import (
"fmt"
"os"
"sort"
"strings"
"sync"
log "github.com/sirupsen/logrus"
@ -105,14 +106,25 @@ func main() {
}
func addIfNotExists(entries []entry, e entry) []entry {
var (
found bool
out []entry
)
for _, pe := range entries {
if pe.Domain == e.Domain {
// Entry already exists, skip
return entries
found = true
pe.Comment = strings.Join([]string{pe.Comment, e.Comment}, ", ")
}
out = append(out, pe)
}
return append(entries, e)
if !found {
out = append(out, e)
}
return out
}
func cleanFromList(blacklist, whitelist []entry) []entry {

Binary file not shown.