cdp

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package cdp captures an OpenObserve browser session by driving a Chromium-family browser over the Chrome DevTools Protocol. It implements webauth.Driver for openobserve-cli, and for o3 on platforms with no native WebView shell.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoBrowser reports that no Chromium-family browser could be located.
	ErrNoBrowser = errNoBrowser
	// ErrCancelled reports that the user closed the browser before signing in.
	ErrCancelled = errors.New("browser sign-in was cancelled")
	// ErrTimeout reports that sign-in did not complete in time.
	ErrTimeout = errors.New("browser sign-in timed out")
)

Sentinel errors the CLI layer maps onto its own cerrors codes.

Functions

func DefaultProfileDir

func DefaultProfileDir(configDir string) string

DefaultProfileDir is the CLI-owned persistent browser profile. Keeping the identity-provider session between logins is what stops every sign-in from requiring a full SSO round trip.

Types

type Driver

type Driver struct {
	// contains filtered or unexported fields
}

Driver captures a session by driving a Chromium-family browser over the DevTools Protocol. It implements webauth.Driver.

func New

func New(opts Options) *Driver

New returns a Driver configured by opts.

func (*Driver) Capture

func (d *Driver) Capture(loginURL, host string, verify webauth.VerifyFunc) (pkgauth.Session, error)

Capture opens the browser at loginURL and blocks until the session is verified, the user closes the browser, or the timeout elapses.

type Options

type Options struct {
	// ProfileDir is the browser profile to use. Empty means a temporary
	// directory removed when Capture returns, which forces a fresh login every
	// time; callers wanting a remembered identity-provider session pass a
	// persistent path.
	ProfileDir string
	// Timeout bounds a whole sign-in. Zero selects defaultTimeout.
	Timeout time.Duration
}

Options configures a Driver.

Jump to

Keyboard shortcuts

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