browser

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package browser finds and launches a locally installed Chromium browser.

It exists so a capture can be taken from the browser the user actually has, rather than from a downloaded one that might differ from it. A profile is only as good as the browser it was measured from, and "some Chrome" is not the same claim as "this Chrome".

Nothing here touches the user's real browser profile. Every launch gets a fresh temporary user-data directory, which keeps their history, cookies and extensions out of it — and, just as importantly, keeps the ignore-certificate-errors flag this capture needs from ever being applied to a profile they browse with.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Browser

type Browser struct {
	// Name is the key it was found under, e.g. "chrome".
	Name string
	// Path is the executable.
	Path string
}

Browser is a launchable browser found on this machine.

func Find

func Find(name string) (*Browser, error)

Find locates a browser. An empty name searches; a name containing a path separator is taken as an executable path and used as given.

func (*Browser) Open

func (b *Browser) Open(ctx context.Context, url string, opts Options) (close func(), err error)

Open launches the browser at a URL and returns a function that closes it.

The temporary profile directory is removed by the returned function. The context kills the process; the caller should still call the close function to clean up the directory.

type Options

type Options struct {
	// Headless runs without a window. Chrome's modern headless mode shares the
	// network stack with headed Chrome, and the handshakes were measured
	// identical — same JA4, same HTTP/2 fingerprint, same header order. Headed is
	// still the default for capture, because "identical today" is a measurement,
	// not a guarantee, and the browser the user is impersonating is a headed one.
	Headless bool

	// Args are appended last, so a caller can override anything below.
	Args []string
}

Options controls a launch.

Jump to

Keyboard shortcuts

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