func HasValidTLD(domain string, when time.Time) bool {
	labels := strings.Split(strings.ToLower(domain), ".")
	rightLabel := labels[len(labels)-1]
	// if the rightmost label is not present in the tldMap, it isn't valid and
	// never was.
	if tldPeriod, present := tldMap[rightLabel]; !present {
		return false
	} else if tldPeriod.Valid(when) != nil {
		// If the TLD exists but the date is outside of the gTLD's validity period
		// then it is not a valid TLD.
		return false
	}
	// Otherwise the TLD exists, and was a valid TLD delegated in the root DNS
	// at the time of the given date.
	return true
}
func HasValidTLD(domain string, when time.Time) bool {
	labels := strings.Split(strings.ToLower(domain), ".")
	rightLabel := labels[len(labels)-1]
	// if the rightmost label is not present in the tldMap, it isn't valid and
	// never was.
	if tldPeriod, present := tldMap[rightLabel]; !present {
		return false
	} else if tldPeriod.Valid(when) != nil {
		// If the TLD exists but the date is outside of the gTLD's validity period
		// then it is not a valid TLD.
		return false
	}
	// Otherwise the TLD exists, and was a valid TLD delegated in the root DNS
	// at the time of the given date.
	return true
}
func HasValidTLD ( domain string , when time . Time ) bool { labels := strings . Split ( strings . ToLower ( domain ) , " " ) rightLabel := labels [ len ( labels ) - 1 ] // if the rightmost label is not present in the tldMap, it isn't valid and // never was. if tldPeriod , present := tldMap [ rightLabel ] ; ! present { return false } else if tldPeriod . Valid ( when ) != nil { // If the TLD exists but the date is outside of the gTLD's validity period // then it is not a valid TLD. return false } // Otherwise the TLD exists, and was a valid TLD delegated in the root DNS // at the time of the given date. return true }
// HasValidTLD checks that a domain ends in a valid TLD that was delegated in
// the root DNS at the time specified.
HasValidTLD checks that a domain ends in a valid TLD that was delegated in the root DNS at the time specified .