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 ¶
View Source
const DomainRegexpStr = "^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])(\\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9]))*$"
DomainRegexpStr is a regular expression string to validate domains.
Variables ¶
View Source
var ExtendedTLDs = map[string]bool{ "BIT": true, "ONION": true, "ETH": true, "CRYPTO": true, "ZIL": true, "BBS": true, "CHAN": true, "CYB": true, "DYN": true, "EPIC": true, "GEEK": true, "GOPHER": true, "INDY": true, "LIBRE": true, "NEO": true, "NULL": true, "O": true, "OSS": true, "OZ": true, "PARODY": true, "PIRATE": true, }
ExtendedTLDs is a set of additional "TLDs", allowing decentralized name systems, like TOR and Namecoin.
View Source
var TLDs = map[string]bool{}/* 1513 elements not displayed */
Version 2020051300, Last Updated Wed May 13 07:07:01 2020 UTC ¶
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.
Click to show internal directories.
Click to hide internal directories.