mirror of
https://github.com/safing/portmaster
synced 2025-09-02 02:29:12 +00:00
14 lines
335 B
Go
14 lines
335 B
Go
package netutils
|
|
|
|
import (
|
|
"regexp"
|
|
)
|
|
|
|
var (
|
|
cleanDomainRegex = regexp.MustCompile(`^((xn--)?[a-z0-9-_]{0,61}[a-z0-9]{1,1}\.)*(xn--)?([a-z0-9-]{1,61}|[a-z0-9-]{1,30}\.[a-z]{2,}\.)$`)
|
|
)
|
|
|
|
// IsValidFqdn returns whether the given string is a valid fqdn.
|
|
func IsValidFqdn(fqdn string) bool {
|
|
return cleanDomainRegex.MatchString(fqdn)
|
|
}
|