internal/hostname
import "github.com/gofiber/fiber/v3/internal/hostname"
Package hostname splits host:port values and converts IDN host names.
Functions
func SplitPort(authority string) (host, port string)
Source: internal/hostname/hostname.go:16
SplitPort splits "host[:port]" into host and port without trimming. A bracketed IPv6 literal keeps its brackets and ends at the first ']', and anything after it but a ":port" is dropped. A value with several colons is returned whole as a bare IPv6 literal. An unclosed '[' is not a literal, so "[a:80" splits like any other host into "[a" and "80".
func ToASCII(host string) string
Source: internal/hostname/hostname.go:41
ToASCII converts a non-ASCII host to Punycode. IDNA has no concept of a port, so a caller holding "host:port" splits it first: a host with a colon is returned unchanged. So are an ASCII host and one idna.Lookup rejects, so an invalid host fails by not matching.
func ToUnicode(host string) string
Source: internal/hostname/hostname.go:55
ToUnicode decodes the Punycode labels of host. "xn--" anywhere in host sends all of it through idna.Lookup, which also maps the other labels (width, dots, soft hyphens), and a single label it rejects leaves the whole host unchanged. The xn-- check is case-sensitive, so callers fold ASCII case first.