2018-02-01 09:09:02 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
"regexp"
|
2019-09-26 04:43:17 +00:00
|
|
|
)
|
2018-02-01 09:09:02 +00:00
|
|
|
|
|
|
|
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 {
|
2018-09-01 01:27:26 +00:00
|
|
|
return net.ParseIP(ip) != nil
|
2019-09-26 04:43:17 +00:00
|
|
|
}
|