Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Announce ¶
func Announce(w http.ResponseWriter, headers []string)
Add Accept-CH to the response header.
Note: Client hints are accessible only on secure origins (via TLS).
Example:
ch.Announce(w, []string{headers.SecChUa, headers.SecChUaBitness})
func AnnounceNoVary ¶
func AnnounceNoVary(w http.ResponseWriter, headers []string)
Add Accept-CH to the response header. No Vary header is added.
Note: Client hints are accessible only on secure origins (via TLS).
Example:
ch.AnnounceNoVary(w, []string{headers.SecChUa, headers.SecChUaBitness})
func ParseSecChUa ¶
Parse the Sec-CH-UA header. Returns a map of "brand name - version".
Example:
chUa := r.Header.Get(ch.SecChUa) brands := ch.ParseSecChUa(chUa)
Types ¶
type MobileType ¶
type MobileType int
const ( Mobile MobileType = iota NoMobile Unknown )
func ParseChUaMobile ¶
func ParseChUaMobile(chUaMobile string) MobileType
Determine if mobile or not.
Example:
chUaMobile := r.Header.Get(ch.SecChUaMobile) mobileType := ch.ParseChUaMobile(chUaMobile)
Click to show internal directories.
Click to hide internal directories.