Skip to content

brainplusplus/go-browserforge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-browserforge

Go port of BrowserForge, intended to provide realistic browser header and fingerprint generation for Go automation stacks.

This repository is intentionally separate from go-camoufox. BrowserForge is a reusable fingerprint/header generation engine, while go-camoufox is a Camoufox browser launcher/runtime.

Goal

The target is API and behavior parity with Python BrowserForge where practical:

  • headers.Generator for HTTP header generation.
  • fingerprints.Generator for navigator, screen, codecs, WebGL, fonts, and related fingerprint data.
  • Bayesian-network sampling from the same Apify datapoint model used by Python BrowserForge.
  • Go-friendly deterministic tests comparing constraints and generated shapes against the Python reference.

Status

Implemented:

  • Embedded Apify BrowserForge datapoints.
  • Go Bayesian-network sampler compatible with the Python BrowserForge network shape.
  • Header generation with browser, OS, device, locale, HTTP version, user-agent, and request-dependent header constraints.
  • Fingerprint generation with BrowserForge screen constraints and navigator/header consistency.
  • Tests for Firefox header generation, request-dependent headers, fingerprint screen constraints, and invalid constraints.
  • Python reference parity matrix tests for Firefox desktop fingerprints across Windows, Linux, macOS, plus strict impossible screen constraints.

The Go API is idiomatic rather than a line-for-line Python API clone, but the generation model and data source are the same BrowserForge/Apify network files.

Python parity tests run automatically when a local Python BrowserForge reference is available. Set BROWSERFORGE_PYTHON and BROWSERFORGE_PYTHONPATH to point at an explicit reference environment.

Example

package main

import (
	"fmt"

	"github.com/brainplusplus/go-browserforge/fingerprints"
	"github.com/brainplusplus/go-browserforge/headers"
)

func main() {
	fp, err := fingerprints.Generate(fingerprints.Options{
		Screen: &fingerprints.Screen{
			MinWidth:  1280,
			MaxWidth:  1920,
			MinHeight: 720,
			MaxHeight: 1200,
		},
		Headers: headers.Options{
			Browsers:         []headers.Browser{{Name: "firefox", MinVersion: 135}},
			OperatingSystems: []string{"windows"},
			Devices:          []string{"desktop"},
			Locales:          []string{"en-US"},
		},
	})
	if err != nil {
		panic(err)
	}
	fmt.Println(fp.Navigator.UserAgent)
	fmt.Println(fp.Screen.Width, fp.Screen.Height)
}

License

Apache License 2.0, matching the upstream BrowserForge and Apify fingerprint datapoints licensing.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages