protocolstate

package
v3.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 30 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
)
View Source
var (
	MaxThreadsOnLowMemory          = env.GetEnvOrDefault("MEMGUARDIAN_THREADS", 0)
	MaxBytesBufferAllocOnLowMemory = env.GetEnvOrDefault("MEMGUARDIAN_ALLOC", 0)
)
View Source
var (
	Dialer *fastdialer.Dialer
)

Dialer is a shared fastdialer instance for host DNS resolution

View Source
var Memoizer *memoize.Memoizer

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 GlobalGuardBytesBufferAlloc added in v3.2.1

func GlobalGuardBytesBufferAlloc() error

Global setting

func GlobalRestoreBytesBufferAlloc added in v3.2.1

func GlobalRestoreBytesBufferAlloc()

Global setting

func GuardThreadsOrDefault added in v3.2.1

func GuardThreadsOrDefault(current int) int

GuardThreads on caller

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 IsLowOnMemory added in v3.2.1

func IsLowOnMemory() bool

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 StartActiveMemGuardian added in v3.2.1

func StartActiveMemGuardian()

func StopActiveMemGuardian added in v3.2.1

func StopActiveMemGuardian()

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