View definition

func IsDomainName

Defined in


IsDomainName checks if s is a valid domain name, it returns the number of labels and true, when a domain name is valid. Note that non fully qualified domain name is considered valid, in this case the last label is counted in the number of labels. When false is returned the number of labels is not defined. Also note that this function is extremely liberal; almost any string is a valid domain name as the DNS is 8 bit protocol. It checks if each label fits in 63 characters, but there is no length check for the entire string s. I.e. a domain name longer than 255 characters is considered valid.

IsDomainName is referenced in 7 repositories