mirror of
https://github.com/Luzifer/named-blacklist.git
synced 2024-11-08 07:20:07 +00:00
Fix comments, speed up
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
9d52d69430
commit
09170e8f8d
2 changed files with 5 additions and 16 deletions
19
main.go
19
main.go
|
@ -106,25 +106,14 @@ func main() {
|
|||
}
|
||||
|
||||
func addIfNotExists(entries []entry, e entry) []entry {
|
||||
var (
|
||||
found bool
|
||||
out []entry
|
||||
)
|
||||
|
||||
for _, pe := range entries {
|
||||
for i, pe := range entries {
|
||||
if pe.Domain == e.Domain {
|
||||
found = true
|
||||
pe.Comment = strings.Join([]string{pe.Comment, e.Comment}, ", ")
|
||||
entries[i].Comment = strings.Join([]string{pe.Comment, e.Comment}, ", ")
|
||||
return entries
|
||||
}
|
||||
|
||||
out = append(out, pe)
|
||||
}
|
||||
|
||||
if !found {
|
||||
out = append(out, e)
|
||||
}
|
||||
|
||||
return out
|
||||
return append(entries, e)
|
||||
}
|
||||
|
||||
func cleanFromList(blacklist, whitelist []entry) []entry {
|
||||
|
|
|
@ -54,7 +54,7 @@ func (p providerHostFile) GetDomainList(d providerDefinition) ([]entry, error) {
|
|||
continue
|
||||
}
|
||||
|
||||
comment := fmt.Sprintf("From: %q", d.Name)
|
||||
comment := fmt.Sprintf("%q", d.Name)
|
||||
if len(groups) == 3 && strings.Trim(groups[2], "#") != "" {
|
||||
comment = fmt.Sprintf("%s, Comment: %q",
|
||||
comment,
|
||||
|
|
Loading…
Reference in a new issue