Help us shape the future of Go! Take the 2026 Go Developer Survey

clienthints

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2026 License: LGPL-3.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BrandVersion

type BrandVersion struct {
	Brand   string
	Version string
}

BrandVersion represents a browser brand and its version.

type ClientHints

type ClientHints struct {
	// contains filtered or unexported fields
}

ClientHints represents the parsed client hints data

func Factory

func Factory(headers map[string]interface{}) *ClientHints

Factory creates a ClientHints object from headers. It supports three header formats: 1. Standard HTTP headers: sec-ch-ua, sec-ch-ua-mobile, etc. 2. PHP $_SERVER style: HTTP_SEC_CH_UA, HTTP_SEC_CH_UA_MOBILE, etc. 3. JavaScript navigator.userAgentData API format:

  • fullVersionList: []map[string]string{{"brand": "...", "version": "..."}, ...}
  • mobile: bool
  • platform: string
  • platformVersion: string
  • formFactors: []string

func New

func New(headers http.Header) *ClientHints

New creates a ClientHints object from HTTP headers. This is a convenience wrapper around Factory for the common case where headers come from an HTTP request.

func (*ClientHints) GetApp

func (ch *ClientHints) GetApp() string

func (*ClientHints) GetArchitecture

func (ch *ClientHints) GetArchitecture() string

func (*ClientHints) GetBitness

func (ch *ClientHints) GetBitness() string

func (*ClientHints) GetBrandList

func (ch *ClientHints) GetBrandList() map[string]string

func (*ClientHints) GetBrandVersion

func (ch *ClientHints) GetBrandVersion() string

func (*ClientHints) GetFormFactors

func (ch *ClientHints) GetFormFactors() []string

func (*ClientHints) GetModel

func (ch *ClientHints) GetModel() string

func (*ClientHints) GetOperatingSystem

func (ch *ClientHints) GetOperatingSystem() string

func (*ClientHints) GetOperatingSystemVersion

func (ch *ClientHints) GetOperatingSystemVersion() string

func (*ClientHints) IsMobile

func (ch *ClientHints) IsMobile() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL