1
0
Fork 0
mirror of https://github.com/Luzifer/named-blacklist.git synced 2024-11-09 16:00:09 +00:00
named-blacklist/helpers.go
2019-08-25 20:38:08 +02:00

37 lines
648 B
Go

package main
import (
"strings"
"golang.org/x/net/idna"
"github.com/Luzifer/go_helpers/v2/str"
)
var genericBlacklist = []string{
"broadcasthost",
"ip6-allhosts",
"ip6-allnodes",
"ip6-allrouters",
"ip6-localnet",
"ip6-mcastprefix",
"local",
"localhost",
"localhost.localdomain",
}
func lineIsComment(line string) bool {
if len(strings.TrimSpace(line)) == 0 {
return true
}
return line[0] == '#' || line[0] == ';' || line[0] == '!'
}
func isBlacklisted(domain string) bool {
return str.StringInSlice(domain, genericBlacklist)
}
func domainToPunycode(name string, v ...string) (string, error) {
return idna.ToASCII(name)
}