Documentation
¶
Overview ¶
Package site computes what browsers call a site: a scheme and a registrable domain (public suffix list), the unit of SameSite cookies, sec-fetch-site and cookie partitions; and the ASCII form of a host name (ASCII), in which browsers send and match it.
Registrable and Of are memoized per host: every request asks for them several times (sec-fetch-site, the cookie jar's SameSite context), and computing them allocates (the public suffix lookup, the IP parse).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ASCII ¶ added in v0.3.0
ASCII returns domain as browsers send it and match cookies against: lowercase, and a name with non-ASCII characters through UTS #46 ToASCII ("Bücher.de" is "xn--bcher-kva.de"), an error when that fails. An ASCII name is only lowercased.
func IsPublicSuffix ¶
IsPublicSuffix reports whether domain is a public suffix ("com", "co.uk"), where no cookie may be set for a whole domain.
func Loopback ¶
Loopback reports a loopback host (Secure Contexts): localhost, a name under .localhost, or a loopback IP address.
func Registrable ¶
Registrable returns host's registrable domain (eTLD+1), or the host itself for IP addresses and hosts without one.
func Trustworthy ¶
Trustworthy reports a potentially trustworthy URL (Secure Contexts): https or wss, or a loopback host.
Types ¶
This section is empty.