Documentation
¶
Overview ¶
Package hostname decides whether a name may be handed to ssh or put into a URL as a host.
A node name reaches places that give some characters a meaning: ssh reads a leading "-" as an option, and a URL reads ":", "@", "/", "?" and "#" as the port, the userinfo, the path, the query and the fragment. Checking each place for the characters it happens to care about would miss the next one, so a name is accepted only when it is spelled in the host name alphabet of RFC 1123, in which none of them has a meaning.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Check ¶
Check reports whether name is a host name: dot separated labels of ASCII letters, digits and hyphens, none of them empty, none longer than 63 characters, and none beginning or ending with a hyphen. A single final dot is allowed, since it only says the name is fully qualified.
An IPv4 address in dotted form passes, because it is spelled in the same alphabet. An IPv6 address does not; use CheckHost where one is expected.
Types ¶
This section is empty.