mirror of
https://github.com/Luzifer/named-blacklist.git
synced 2024-09-19 16:23:00 +00:00
Collect comments for all sources
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
2a224984a5
commit
9d52d69430
20
main.go
20
main.go
@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
@ -105,14 +106,25 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func addIfNotExists(entries []entry, e entry) []entry {
|
func addIfNotExists(entries []entry, e entry) []entry {
|
||||||
|
var (
|
||||||
|
found bool
|
||||||
|
out []entry
|
||||||
|
)
|
||||||
|
|
||||||
for _, pe := range entries {
|
for _, pe := range entries {
|
||||||
if pe.Domain == e.Domain {
|
if pe.Domain == e.Domain {
|
||||||
// Entry already exists, skip
|
found = true
|
||||||
return entries
|
pe.Comment = strings.Join([]string{pe.Comment, e.Comment}, ", ")
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return append(entries, e)
|
out = append(out, pe)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !found {
|
||||||
|
out = append(out, e)
|
||||||
|
}
|
||||||
|
|
||||||
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
func cleanFromList(blacklist, whitelist []entry) []entry {
|
func cleanFromList(blacklist, whitelist []entry) []entry {
|
||||||
|
BIN
named-blacklist
BIN
named-blacklist
Binary file not shown.
Loading…
Reference in New Issue
Block a user