Skip to main content

StealthConfig

Struct StealthConfig 

Source
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: BrowserConfig

Underlying browser configuration shared with non-stealth sessions. All standard settings (timeout, proxy, headers, etc.) live here.

§allow_webgl: bool

Allow 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: bool

Inject 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: bool

Disable 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: bool

Automatically 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

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for StealthConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StealthConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more