Files
onepanel/pkg/util/validate/validate.go
2020-04-30 16:47:25 -07:00

15 lines
264 B
Go

package validate
import (
"github.com/asaskevich/govalidator"
"strings"
)
func IsDNSHost(str string) bool {
if str == "" || len(strings.Replace(str, ".", "", -1)) > 63 {
// constraints already violated
return false
}
return govalidator.IsDNSName(str)
}