pub struct BrowserConfigBuilder { /* private fields */ }Expand description
Fluent builder for BrowserConfig.
Implementations§
Source§impl BrowserConfigBuilder
impl BrowserConfigBuilder
Sourcepub fn chrome_path(self, path: PathBuf) -> Self
pub fn chrome_path(self, path: PathBuf) -> Self
Set path to the Chrome executable.
Sourcepub const fn window_size(self, width: u32, height: u32) -> Self
pub const fn window_size(self, width: u32, height: u32) -> Self
Set browser viewport / window size.
Sourcepub fn proxy_bypass_list(self, bypass: String) -> Self
pub fn proxy_bypass_list(self, bypass: String) -> Self
Set a comma-separated proxy bypass list.
§Example
use stygian_browser::BrowserConfig;
let cfg = BrowserConfig::builder()
.proxy("http://proxy:8080".to_string())
.proxy_bypass_list("<local>,localhost".to_string())
.build();
assert!(cfg.effective_args().iter().any(|a| a.contains("proxy-bypass")));Sourcepub fn webrtc(self, webrtc: WebRtcConfig) -> Self
pub fn webrtc(self, webrtc: WebRtcConfig) -> Self
Set WebRTC IP-leak prevention config.
§Example
use stygian_browser::BrowserConfig;
use stygian_browser::webrtc::{WebRtcConfig, WebRtcPolicy};
let cfg = BrowserConfig::builder()
.webrtc(WebRtcConfig { policy: WebRtcPolicy::BlockAll, ..Default::default() })
.build();
assert!(cfg.effective_args().iter().any(|a| a.contains("disable_non_proxied")));Sourcepub const fn stealth_level(self, level: StealthLevel) -> Self
pub const fn stealth_level(self, level: StealthLevel) -> Self
Set the stealth level.
Sourcepub const fn cdp_fix_mode(self, mode: CdpFixMode) -> Self
pub const fn cdp_fix_mode(self, mode: CdpFixMode) -> Self
Set the CDP leak-mitigation mode.
§Example
use stygian_browser::BrowserConfig;
use stygian_browser::cdp_protection::CdpFixMode;
let cfg = BrowserConfig::builder()
.cdp_fix_mode(CdpFixMode::IsolatedWorld)
.build();
assert_eq!(cfg.cdp_fix_mode, CdpFixMode::IsolatedWorld);Sourcepub fn source_url(self, url: Option<String>) -> Self
pub fn source_url(self, url: Option<String>) -> Self
Override the sourceURL injected into CDP scripts, or pass None to
disable sourceURL patching.
§Example
use stygian_browser::BrowserConfig;
let cfg = BrowserConfig::builder()
.source_url(Some("main.js".to_string()))
.build();
assert_eq!(cfg.source_url.as_deref(), Some("main.js"));Sourcepub const fn pool(self, pool: PoolConfig) -> Self
pub const fn pool(self, pool: PoolConfig) -> Self
Override pool settings.
Sourcepub fn build(self) -> BrowserConfig
pub fn build(self) -> BrowserConfig
Build the final BrowserConfig.
Auto Trait Implementations§
impl Freeze for BrowserConfigBuilder
impl RefUnwindSafe for BrowserConfigBuilder
impl Send for BrowserConfigBuilder
impl Sync for BrowserConfigBuilder
impl Unpin for BrowserConfigBuilder
impl UnsafeUnpin for BrowserConfigBuilder
impl UnwindSafe for BrowserConfigBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more