Documentation ¶
Index ¶
- Variables
- func Close()
- func FailWithReason(page *rod.Page, e *proto.FetchRequestPaused) error
- func GlobalGuardBytesBufferAlloc() error
- func GlobalRestoreBytesBufferAlloc()
- func GuardThreadsOrDefault(current int) int
- func Init(options *types.Options) error
- func InitHeadless(localFileAccess bool, np *networkpolicy.NetworkPolicy)
- func IsHostAllowed(targetUrl string) bool
- func IsLFAAllowed() bool
- func IsLowOnMemory() bool
- func NewJSRuntime() *goja.Runtime
- func NormalizePath(filePath string) (string, error)
- func StartActiveMemGuardian(ctx context.Context)
- func StopActiveMemGuardian()
- func ValidateNFailRequest(page *rod.Page, e *proto.FetchRequestPaused) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrURLDenied = errorutil.NewWithFmt("headless: url %v dropped by rule: %v") ErrHostDenied = errorutil.NewWithFmt("host %v dropped by network policy") NetworkPolicy *networkpolicy.NetworkPolicy )
var ( MaxThreadsOnLowMemory = env.GetEnvOrDefault("MEMGUARDIAN_THREADS", 0) MaxBytesBufferAllocOnLowMemory = env.GetEnvOrDefault("MEMGUARDIAN_ALLOC", 0) )
var (
Dialer *fastdialer.Dialer
)
Dialer is a shared fastdialer instance for host DNS resolution
var Memoizer *memoize.Memoizer
Functions ¶
func FailWithReason ¶
func FailWithReason(page *rod.Page, e *proto.FetchRequestPaused) error
FailWithReason fails request with AccessDenied reason
func InitHeadless ¶
func InitHeadless(localFileAccess bool, np *networkpolicy.NetworkPolicy)
InitHeadless initializes headless protocol state
func IsHostAllowed ¶
IsHostAllowed checks if the host is allowed by network policy
func IsLFAAllowed ¶
func IsLFAAllowed() bool
IsLFAAllowed returns true if local file access is allowed
func IsLowOnMemory ¶
func IsLowOnMemory() bool
func NewJSRuntime ¶
NewJSRuntime returns a new javascript runtime with defaults set i.e sourcemap parsing is disabled by default
func NormalizePath ¶
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 ¶
func StopActiveMemGuardian ¶
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.