browser

package
v0.8.12 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProfileChromeWinUS   = "chrome-win-uhd620"
	ProfileChromeMacUS   = "chrome-macos-intel-iris"
	ProfileChromeLinuxUS = "chrome-linux-mesa-uhd620"
)

Variables

This section is empty.

Functions

func DefaultRegionForEngine

func DefaultRegionForEngine(engine string) string

func LaneKey

func LaneKey(engine string, region string) string

func LoadProfilesFromJSON

func LoadProfilesFromJSON(path string) error

func NormalizeEngine

func NormalizeEngine(engine string) string

func NormalizeRegion

func NormalizeRegion(region string) string

Types

type BrandVersion

type BrandVersion struct {
	Brand   string `json:"brand"`
	Version string `json:"version"`
}

type Profile

type Profile struct {
	ID                string         `json:"id"`
	UserAgentTemplate string         `json:"user_agent_template"`
	UserAgent         string         `json:"user_agent,omitempty"`
	UACHBrands        []BrandVersion `json:"uach_brands,omitempty"`
	UACHFullVerList   []BrandVersion `json:"uach_full_version_list,omitempty"`
	Platform          string         `json:"platform"`
	PlatformVersion   string         `json:"platform_version"`
	Architecture      string         `json:"architecture"`
	Bitness           string         `json:"bitness"`
	Mobile            bool           `json:"mobile"`
	AcceptLanguage    string         `json:"accept_language"`
	NavigatorLangs    []string       `json:"navigator_langs"`
	Locale            string         `json:"locale"`
	Timezone          string         `json:"timezone"`
	Viewport          Viewport       `json:"viewport"`
	Tags              []string       `json:"tags"`
	Weight            int            `json:"weight"`
}

func Catalog

func Catalog() []Profile

func ProfileByID added in v0.7.13

func ProfileByID(profileID string) (Profile, bool)

ProfileByID looks up a profile by exact ID. Returns (profile, true) when found, (zero, false) when the ID is not in the catalog. Unlike the internal profileByID, it does not fall back to a default; the caller decides what to do on miss.

func SelectProfile

func SelectProfile(engine string, region string) Profile

SelectProfile returns a deterministic profile for the given engine and region. It respects lane_profile_ids overrides and falls back to the OS-preferred default. Used by tests and single-instance callers; internally delegates to SelectProfileForSession with empty salt.

func SelectProfileForSession added in v0.7.13

func SelectProfileForSession(engine, region, salt string) Profile

SelectProfileForSession picks a profile for (engine, region, salt). If a lane_profile_ids override exists it is always honoured. Empty salt picks the first eligible profile (same as SelectProfile). Non-empty salt uses weighted selection seeded by FNV-1a hash of salt, giving each session a stable but varied profile.

func SelectProfileForSessionHeadless added in v0.8.12

func SelectProfileForSessionHeadless(engine, region, salt string, headless bool) Profile

SelectProfileForSessionHeadless is SelectProfileForSession, but headless Linux (the Docker deployment) renders WebGL via SwiftShader, so it only picks swiftshader-tagged profiles. Runtimes with a real GPU exclude them.

type Viewport

type Viewport struct {
	Width  int `json:"width"`
	Height int `json:"height"`
}

Jump to

Keyboard shortcuts

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