validator

package
v0.0.0-...-3cdddeb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 6 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Domain

func Domain(d string) bool

Domain returns whether d is valid domain.

This function returns false for "." (root domain).

func DomainPart

func DomainPart(d string) bool

DomainPart returns whether d is valid domain part (eg.: subdomain part or Second Level Domain).

Domain d can be up to 63 character long, can include a-z, A-Z, 0-9 and "-". The string must not starts and ends with a hyphen ("-") and two consecutive hyphen is not allowed.

func Email

func Email(v string) bool

func IP

func IP[T IPTypes](v T) bool

Returns whether v is a valid IP address.

func IPv4

func IPv4[T IPTypes](v T) bool

Returns whether v is a valid IPv4 address.

func IPv6

func IPv6[T IPTypes](v T) bool

Returns whether v is a valid IPv6 address.

func Port

func Port[T PortTypes](v T) bool

func URL

func URL(v string) bool

Returns whether v is a valid, absolute URL.

Types

type IPTypes

type IPTypes interface {
	net.IP | *net.IP | netip.Addr | *netip.Addr | string | *string
}

type PortTypes

type PortTypes interface {
	int8 | uint8 | int16 | uint16 | int32 | uint32 | int64 | uint64 | int | uint | uintptr | string | *string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL