// IPv4 checks if the given string is a valid IP v4 address and returns an error if not.
// Based on net.ParseIP.
IPv4 checks if the given string is a valid IP v4 address and returns an error if not.
Based on net.ParseIP.
// IPv4 checks if the given string is a valid IP v4 address and returns an error if not . // Based on net . ParseIP .
func IPv4(v string) error {
	if err := nonEmpty(v); err != nil {
		return err
	}
	if ip := net.ParseIP(v); ip == nil || !strings.Contains(v, ".") {
		return errors.New("invalid IPv4 address")
	}
	return nil
}
func IPv4 ( v string ) error { if err := nonEmpty ( v ) ; err != nil { return err } if ip := net . ParseIP ( v ) ; ip == nil || ! strings . Contains ( v , " " ) { return errors . New ( " " ) } return nil }
IPv4 checks if the given string is a valid IP v4 address and returns an error if not.
IPv4 checks if the given string is a valid IP v4 address and returns an error if not .