1
0
Fork 0
mirror of https://github.com/Luzifer/named-blacklist.git synced 2024-11-08 23:40:06 +00:00
named-blacklist/helpers.go

38 lines
648 B
Go
Raw Normal View History

2019-08-25 18:38:08 +00:00
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)
}