provider

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package provider defines the interface for connecting to a Chrome instance. The default Local provider wraps the existing launcher. Future cloud providers (Browserless, Browserbase) implement the same interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectOpts

type ConnectOpts struct {
	Headless    bool
	Proxy       string
	UserDataDir string
	TimeoutSec  int
}

ConnectOpts carries the parameters any provider needs to set up a connection.

type Local

type Local struct{}

Local provisions Chrome by launching a local process via Rod's launcher.

func (Local) Connect

func (Local) Connect(_ context.Context, opts ConnectOpts) (string, func(), error)

func (Local) Name

func (Local) Name() string

type Provider

type Provider interface {
	// Name returns a human-readable identifier (e.g. "local", "browserless").
	Name() string

	// Connect provisions a Chrome instance and returns the DevTools WS URL.
	// The cleanup function MUST be called when the browser is no longer needed.
	Connect(ctx context.Context, opts ConnectOpts) (wsURL string, cleanup func(), err error)
}

Provider abstracts Chrome acquisition. A provider returns a WebSocket URL the caller can pass to rod.New().ControlURL(), plus a cleanup function that releases whatever the provider allocated (kill process, release slot, …).

Jump to

Keyboard shortcuts

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