Documentation ¶
Index ¶
Constants ¶
const NoPort = -1
Variables ¶
This section is empty.
Functions ¶
func NormalizeHost ¶
NormalizeHost returns normalized representation of host (Punycode for DNS names, standardized IP address representation).
If forceFQDN is true, returned normalized domain name will include a trailing dot.
func NormalizePort ¶
NormalizePort converts `s` to int if it represents a valid TCP port.
Types ¶
type HostPort ¶
func New ¶
New takes a colon-separated host and port and returns a normalized representation of host (Punycode for DNS names, standardized IP address representation) and a port number.
`s` argument needs to conform to `authority-form` as defined by https://datatracker.ietf.org/doc/html/rfc7230#section-5.3.3. In particular, port must be provided.
If forceFQDN is true, returned normalized domain name will be an FQDN.
func NewWithScheme ¶
NewWithScheme returns host (as string) and port (as int) normalized with `normalizeHost` and `normalizePort`.
`s` is a bare host or a colon-separated (':') host name and port. If no port is specified, the `scheme` string is used to find the default port (https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.3).
If forceFQDN is true, returned normalized domain name will be an FQDN.