browser

package
v0.7.15 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var PatchJS []byte

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"`
	UserAgent       string         `json:"user_agent"`
	UACHBrands      []BrandVersion `json:"uach_brands"`
	UACHFullVerList []BrandVersion `json:"uach_full_version_list"`
	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"`
	WebGLVendor     string         `json:"webgl_vendor"`
	WebGLRenderer   string         `json:"webgl_renderer"`
	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.

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