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.

13 lines
242 B

package util
import "regexp"
func MatchIP(ip string) bool {
ipReg := `^((0|[1-9]\d?|1\d\d|2[0-4]\d|25[0-5])\.){3}(0|[1-9]\d?|1\d\d|2[0-4]\d|25[0-5])$`
match, _ := regexp.MatchString(ipReg, ip)
if match {
return true
}
return false
}