protocolstate

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: MIT Imports: 20 Imported by: 72

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrURLDenied  = errorutil.NewWithFmt("headless: url %v dropped by rule: %v")
	ErrHostDenied = errorutil.NewWithFmt("host %v dropped by network policy")
)

Dialer is a shared fastdialer instance for host DNS resolution

Functions

func Close

func Close()

Close closes the global shared fastdialer

func FailWithReason

func FailWithReason(page *rod.Page, e *proto.FetchRequestPaused) error

FailWithReason fails request with AccessDenied reason

func Init

func Init(options *types.Options) error

Init creates the Dialer instance based on user configuration

func InitHeadless

func InitHeadless(RestrictLocalNetworkAccess bool, localFileAccess bool)

InitHeadless initializes headless protocol state

func IsHostAllowed

func IsHostAllowed(targetUrl string) bool

IsHostAllowed checks if the host is allowed by network policy

func NewJSRuntime

func NewJSRuntime() *goja.Runtime

NewJSRuntime returns a new javascript runtime with defaults set i.e sourcemap parsing is disabled by default

func NormalizePath

func NormalizePath(filePath string) (string, error)

Normalizepath normalizes path and returns absolute path it returns error if path is not allowed this respects the sandbox rules and only loads files from allowed directories

func ValidateNFailRequest

func ValidateNFailRequest(page *rod.Page, e *proto.FetchRequestPaused) error

ValidateNFailRequest validates and fails request if the request does not respect the rules, it will be canceled with reason

Types

This section is empty.

Jump to

Keyboard shortcuts

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