pub struct StealthConfig {
pub base: BrowserConfig,
pub allow_webgl: bool,
pub hide_canvas: bool,
pub block_webrtc: bool,
pub solve_cloudflare: bool,
}Expand description
Stealth browser configuration – extends BrowserConfig with anti-detection options.
Use this instead of a bare BrowserConfig when scraping sites that employ bot
detection (e.g. Cloudflare, DataDome, PerimeterX). The stealth layer adds
Chromium CLI flags to block WebRTC leaks, disable WebGL, inject canvas noise,
and optionally solve Cloudflare Turnstile challenges automatically.
Fields§
§base: BrowserConfigUnderlying browser configuration shared with non-stealth sessions. All standard settings (timeout, proxy, headers, etc.) live here.
allow_webgl: boolAllow WebGL rendering (disable to reduce fingerprint surface).
Some fingerprinting services read WebGL renderer strings to identify the
GPU and driver version. Set to false to disable WebGL entirely.
Defaults to true.
hide_canvas: boolInject noise into canvas image data to thwart canvas fingerprinting.
When enabled, small random perturbations are applied to pixel data returned
by toDataURL() and getImageData(), making the canvas fingerprint
non-deterministic. Defaults to false.
block_webrtc: boolDisable non-proxied UDP to prevent WebRTC IP leaks.
Without this flag, WebRTC can reveal the machine’s real IP address even
when a proxy is configured. Enable this whenever you use a proxy.
Defaults to false.
solve_cloudflare: boolAutomatically detect and attempt to solve Cloudflare Turnstile challenges.
When enabled the session inspects the page after navigation and, if a
Cloudflare challenge page is detected, attempts to click through it.
The timeout is automatically raised to at least 60 seconds. Defaults to false.
Implementations§
Source§impl StealthConfig
impl StealthConfig
Sourcepub fn validate(&mut self) -> Result<()>
pub fn validate(&mut self) -> Result<()>
Validate the stealth configuration and its underlying BrowserConfig.
If solve_cloudflare is enabled and the timeout is below 60 seconds, the
timeout is automatically raised to 60 seconds to give the solver enough time.
Sourcepub fn extra_stealth_args(&self) -> Vec<String>
pub fn extra_stealth_args(&self) -> Vec<String>
Build additional Chromium command-line flags required by stealth options.
These flags are appended to the default and stealth args in
[engine::build_launch_options] and control WebRTC, canvas, and WebGL behaviour.
Sourcepub fn context_options(&self) -> StealthContextOptions
pub fn context_options(&self) -> StealthContextOptions
Return default stealth context options (viewport, device emulation, permissions). These mimic a typical desktop Chrome session at 1920x1080 with a 2x device pixel ratio, dark colour scheme, and pre-granted geolocation/notification permissions.