Merge pull request #91 from dsanader/fixhostname
Check label and full name length in hostname format
diff --git a/format_checkers.go b/format_checkers.go
index 5e2f304..b91c360 100644
--- a/format_checkers.go
+++ b/format_checkers.go
@@ -5,6 +5,7 @@
"net/url"
"reflect"
"regexp"
+ "strings"
"time"
)
@@ -132,13 +133,13 @@
// Credit: https://github.com/asaskevich/govalidator
func (f IPV4FormatChecker) IsFormat(input string) bool {
ip := net.ParseIP(input)
- return ip != nil && ip.To4() != nil
+ return ip != nil && strings.Contains(input, ".")
}
// Credit: https://github.com/asaskevich/govalidator
func (f IPV6FormatChecker) IsFormat(input string) bool {
ip := net.ParseIP(input)
- return ip != nil && ip.To4() == nil
+ return ip != nil && strings.Contains(input, ":")
}
func (f DateTimeFormatChecker) IsFormat(input string) bool {