package regx import ( "fmt" "testing" ) func TestRegx_IsIp(t *testing.T) { fmt.Println(regx.IsIp("114.114.114.114")) fmt.Println(regx.IsIp("114.114.114.314")) fmt.Println(regx.IsIp("www.baidu.com")) fmt.Println(regx.IsIpRegx("114.114.114.114")) fmt.Println(regx.IsIpRegx("114.114.114.314")) fmt.Println(regx.IsIpRegx("www.baidu.com")) } func TestRegx_IsIpV4(t *testing.T) { fmt.Println(regx.IsIpV4("222.222.222.2242")) fmt.Println(regx.IsIpV6("222.222.222.2242")) } func TestRegx_IsDns(t *testing.T) { fmt.Println(regx.IsDns("www.baidu.com")) fmt.Println(regx.IsDns("www.baidu.com.cn")) fmt.Println(regx.IsDns("www.baidu.com.cn.cn")) }