Documentation
¶
Overview ¶
Package ufnet contains utilities for domain and hostname parsing/validation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractHostname ¶
ExtractHostname quickly retrieves hostname from the given URL.
NOTE: ExtractHostname is an optimized, best-effort function to retrieve a hostname from a URL-like string. The result is not guaranteed to be correct for some edge cases, which include non-hierarchical URLs and IPv6 hostnames.
TODO(a.garipov): Consider moving to golibs.
TODO(s.chzhen): Consider using url.URL.
func IsDomainName ¶
IsDomainName checks if the given string is a valid domain name. Valid domain name has the following syntax: [label.]... label.label. Each label is 1 to 63 characters long, and may contain:
- ASCII letters a-z and A-Z,
- digits 0-9,
- hyphen ('-').
Labels cannot start or end with hyphens (RFC 952). Max length of ASCII hostname including dots is 253 characters. TLD is greater or equal to 2 characters. TLD has "[a-zA-Z]+" or "xn--[a-zA-Z0-9]+" format.
TODO(s.chzhen): Consider using netutil.IsValidHostname. TODO(d.kolyshev): Consider moving to golibs.
Types ¶
This section is empty.