protocolstate

package
v3.1.9 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 24 Imported by: 73

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")
	NetworkPolicy *networkpolicy.NetworkPolicy
)

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(localFileAccess bool, np *networkpolicy.NetworkPolicy)

InitHeadless initializes headless protocol state

func IsHostAllowed

func IsHostAllowed(targetUrl string) bool

IsHostAllowed checks if the host is allowed by network policy

func IsLFAAllowed added in v3.1.4

func IsLFAAllowed() bool

IsLFAAllowed returns true if local file access is allowed

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