Documentation ¶
Overview ¶
Package isdomain package allows users to check whether strings represent domain names.
import ( isd "github.com/jbenet/go-is-domain" ) isd.IsDomain("foo.com") // true isd.IsDomain("foo.bar.com.") // true isd.IsDomain("foo.bar.baz") // false
Index ¶
Constants ¶
const DomainRegexpStr = "^([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z]{2,}$"
DomainRegexpStr is a regular expression string to validate domains.
Variables ¶
var ExtendedTLDs = map[string]bool{ "BIT": true, "ONION": true, }
ExtendedTLDs is a set of additional "TLDs", allowing decentralized name systems, like TOR and Namecoin.
var TLDs = map[string]bool{}/* 725 elements not displayed */
TLDs is a set of TLDs, according to ICANN in 2014.
Functions ¶
func IsDomain ¶
IsDomain returns whether given string is a domain. It first checks the TLD, and then uses a regular expression.
func IsExtendedTLD ¶
IsExtendedTLD returns whether the given string is a TLD (Top Level Domain), extended with a few other "TLDs": .bit, .onion
func IsICANNTLD ¶
IsICANNTLD returns whether the given string is a TLD (Top Level Domain), according to ICANN. Well, really according to the TLDs listed in this package.
Types ¶
This section is empty.