mirror of
https://github.com/Luzifer/named-blacklist.git
synced 2024-11-08 07:20:07 +00:00
37 lines
648 B
Go
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)
|
|
}
|