browser

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package browser provides browser automation utilities including URL allowlist enforcement for sandboxed browser plugins.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Allowlist

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

Allowlist enforces domain restrictions on browser navigation. A nil or empty Allowlist permits all domains (except blocked ranges).

func NewAllowlist

func NewAllowlist(domains []string) *Allowlist

NewAllowlist creates an Allowlist from a list of domain patterns. Supports exact matches ("github.com") and wildcard subdomains ("*.example.com"). An empty list means unrestricted (all non-blocked domains are allowed).

func (*Allowlist) Allowed

func (a *Allowlist) Allowed(rawURL string) (bool, error)

Allowed checks whether a URL is permitted by the allowlist. Returns false if the URL's host matches a blocked range (link-local, metadata endpoints) regardless of the allowlist. If the allowlist is empty, all non-blocked URLs are allowed.

func (*Allowlist) Domains

func (a *Allowlist) Domains() []string

Domains returns the list of allowed domain patterns.

func (*Allowlist) IsEmpty

func (a *Allowlist) IsEmpty() bool

IsEmpty returns true if the allowlist has no domain restrictions.

Jump to

Keyboard shortcuts

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