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 fn user_data_dir(self, path: impl Into<PathBuf>) -> Self
pub fn user_data_dir(self, path: impl Into<PathBuf>) -> Self
Set a custom user profile directory.
When not set, each browser instance automatically uses a unique
temporary directory derived from its instance ID, preventing
SingletonLock races between concurrent pools or instances.
§Example
use stygian_browser::BrowserConfig;
let cfg = BrowserConfig::builder()
.user_data_dir("/tmp/my-profile")
.build();
assert!(cfg.user_data_dir.is_some());Sourcepub const fn headless_mode(self, mode: HeadlessMode) -> Self
pub const fn headless_mode(self, mode: HeadlessMode) -> Self
Choose between --headless=new (default) and the legacy --headless flag.
Only relevant when headless is true. Has no effect
in headed mode.
§Example
use stygian_browser::BrowserConfig;
use stygian_browser::config::HeadlessMode;
let cfg = BrowserConfig::builder()
.headless_mode(HeadlessMode::Legacy)
.build();
assert_eq!(cfg.headless_mode, HeadlessMode::Legacy);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 disable_sandbox(self, disable: bool) -> Self
pub const fn disable_sandbox(self, disable: bool) -> Self
Explicitly control whether --no-sandbox is passed to Chrome.
By default this is auto-detected: true inside containers, false on
bare metal. Override only when the auto-detection is wrong.
§Example
use stygian_browser::BrowserConfig;
// Force sandbox on (bare-metal host)
let cfg = BrowserConfig::builder().disable_sandbox(false).build();
assert!(!cfg.effective_args().iter().any(|a| a == "--no-sandbox"));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.