A simple, go-based DNS resolver/caching server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

18 lines
304 B

package main
import (
"net"
"regexp"
)
func isDomain(domain string) bool {
if isIP(domain) {
return false
}
match, _ := regexp.MatchString(`^([a-zA-Z0-9\*]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$`, domain)
return match
}
func isIP(ip string) bool {
return net.ParseIP(ip) != nil
}