func formatIPv4(value string) bool {
	ip := net.ParseIP(value)
	return ip != nil && ip.To4() != nil
}
formatIPv4 is the validation function for validating if a value is a valid v4 IP address.
package validate
import (
	"bytes"
	"crypto/sha256"
	"net"
	"net/url"
	"os"
	"strings"
	urn "github.com/leodido/go-urn"
)
type FormatType string
const (
	FormatAlpha                FormatType = "alpha"
	FormatAlnum                FormatType = "alnum"
	FormatAlphaUnicode         FormatType = "alpha_unicode"
	FormatAlnumUnicode         FormatType = "alnum_unicode"
	FormatNumeric              FormatType = "numeric"
	FormatNumber               FormatType = "number"
	FormatHexadecimal          FormatType = "hexadecimal"
	FormatHEXColor             FormatType = "hexcolor"
	FormatRGB                  FormatType = "rgb"
	FormatRGBA                 FormatType = "rgba"
	FormatHSL                  FormatType = "hsl"
	FormatHSLA                 FormatType = "hsla"
	FormatEmail                FormatType = "email"
	FormatURL                  FormatType = "url"
	FormatURI                  FormatType = "uri"
	FormatUrnRFC2141           FormatType = "urn_rfc2141"  
	FormatFile                 FormatType = "file"
	FormatBase64               FormatType = "base64"
	FormatBase64URL            FormatType = "base64url"
	FormatISBN                 FormatType = "isbn"
	FormatISBN10               FormatType = "isbn10"
	FormatISBN13               FormatType = "isbn13"
	FormatEthereumAddress      FormatType = "eth_addr"
	FormatBitcoinAddress       FormatType = "btc_addr"
	FormatBitcoinBech32Address FormatType = "btc_addr_bech32"
	FormatUUID                 FormatType = "uuid"
	FormatUUID3                FormatType = "uuid3"
	FormatUUID4                FormatType = "uuid4"
	FormatUUID5                FormatType = "uuid5"
	FormatASCII                FormatType = "ascii"
	FormatPrintableASCII       FormatType = "ascii_print"
	FormatDataURI              FormatType = "datauri"
	FormatLatitude             FormatType = "latitude"
	FormatLongitude            FormatType = "longitude"
	FormatSSN                  FormatType = "ssn"
	FormatIPv4                 FormatType = "ipv4"
	FormatIPv6                 FormatType = "ipv6"
	FormatIP                   FormatType = "ip"
	FormatCIDRv4               FormatType = "cidrv4"
	FormatCIDRv6               FormatType = "cidrv6"
	FormatCIDR                 FormatType = "cidr"
	FormatMAC                  FormatType = "mac"
	FormatHostnameRFC952       FormatType = "hostname"          
	FormatHostnameRFC1123      FormatType = "hostname_rfc1123"  
	FormatFQDN                 FormatType = "fqdn"
	FormatURLEncoded           FormatType = "url_encoded"
	FormatDir                  FormatType = "dir"
	FormatPostcode             FormatType = "postcode"
)
type formatFunc func(value string) bool
func getFormatTypeMap() map[FormatType]formatFunc {
	return map[FormatType]formatFunc{
		FormatAlpha:                formatAlpha,
		FormatAlnum:                formatAlnum,
		FormatAlphaUnicode:         formatAlphaUnicode,
		FormatAlnumUnicode:         formatAlnumUnicode,
		FormatNumeric:              formatNumeric,
		FormatNumber:               formatNumber,
		FormatHexadecimal:          formatHexadecimal,
		FormatHEXColor:             formatHEXColor,
		FormatRGB:                  formatRGB,
		FormatRGBA:                 formatRGBA,
		FormatHSL:                  formatHSL,
		FormatHSLA:                 formatHSLA,
		FormatEmail:                formatEmail,
		FormatURL:                  formatURL,
		FormatURI:                  formatURI,
		FormatUrnRFC2141:           formatUrnRFC2141,
		FormatFile:                 formatFile,
		FormatBase64:               formatBase64,
		FormatBase64URL:            formatBase64URL,
		FormatISBN:                 formatISBN,
		FormatISBN10:               formatISBN10,
		FormatISBN13:               formatISBN13,
		FormatEthereumAddress:      formatEthereumAddress,
		FormatBitcoinAddress:       formatBitcoinAddress,
		FormatBitcoinBech32Address: formatBitcoinBech32Address,
		FormatUUID:                 formatUUID,
		FormatUUID3:                formatUUID3,
		FormatUUID4:                formatUUID4,
		FormatUUID5:                formatUUID5,
		FormatASCII:                formatASCII,
		FormatPrintableASCII:       formatPrintableASCII,
		FormatDataURI:              formatDataURI,
		FormatLatitude:             formatLatitude,
		FormatLongitude:            formatLongitude,
		FormatSSN:                  formatSSN,
		FormatIPv4:                 formatIPv4,
		FormatIPv6:                 formatIPv6,
		FormatIP:                   formatIP,
		FormatCIDRv4:               formatCIDRv4,
		FormatCIDRv6:               formatCIDRv6,
		FormatCIDR:                 formatCIDR,
		FormatMAC:                  formatMAC,
		FormatHostnameRFC952:       formatHostnameRFC952,
		FormatHostnameRFC1123:      formatHostnameRFC1123,
		FormatFQDN:                 formatFQDN,
		FormatURLEncoded:           formatURLEncoded,
		FormatDir:                  formatDir,
		FormatPostcode:             formatPostcode,
	}
}
func formatURLEncoded(value string) bool {
	return uRLEncodedRegex.MatchString(value)
}
func formatMAC(value string) bool {
	_, err := net.ParseMAC(value)
	return err == nil
}
func formatCIDRv4(value string) bool {
	ip, _, err := net.ParseCIDR(value)
	return err == nil && ip.To4() != nil
}
func formatCIDRv6(value string) bool {
	ip, _, err := net.ParseCIDR(value)
	return err == nil && ip.To4() == nil
}
func formatCIDR(value string) bool {
	_, _, err := net.ParseCIDR(value)
	return err == nil
}