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 noise(self, config: NoiseConfig) -> Self
pub const fn noise(self, config: NoiseConfig) -> Self
Set the fingerprint noise configuration.
§Example
use stygian_browser::BrowserConfig;
use stygian_browser::noise::{NoiseConfig, NoiseSeed};
let cfg = BrowserConfig::builder()
.noise(NoiseConfig { seed: Some(NoiseSeed::from(42_u64)), ..Default::default() })
.build();
assert_eq!(cfg.noise.seed.unwrap().as_u64(), 42);Sourcepub fn fingerprint_profile(self, profile: FingerprintProfile) -> Self
pub fn fingerprint_profile(self, profile: FingerprintProfile) -> Self
Set the unified fingerprint profile for coherent identity injection.
§Example
use stygian_browser::BrowserConfig;
use stygian_browser::profile::FingerprintProfile;
let cfg = BrowserConfig::builder()
.fingerprint_profile(FingerprintProfile::windows_chrome_136_rtx3060())
.build();
assert!(cfg.fingerprint_profile.is_some());Sourcepub const fn cdp_hardening(self, config: CdpHardeningConfig) -> Self
pub const fn cdp_hardening(self, config: CdpHardeningConfig) -> Self
Set CDP leak hardening configuration.
§Example
use stygian_browser::BrowserConfig;
use stygian_browser::cdp_hardening::CdpHardeningConfig;
let cfg = BrowserConfig::builder()
.cdp_hardening(CdpHardeningConfig { enabled: false, ..Default::default() })
.build();
assert!(!cfg.cdp_hardening.enabled);Sourcepub fn tls_profile(self, profile: &TlsProfile) -> Self
pub fn tls_profile(self, profile: &TlsProfile) -> Self
Add Chrome launch flags that constrain TLS to match a TlsProfile.
Appends version-constraint flags (e.g. --ssl-version-max=tls1.2)
to the extra args list. See chrome_tls_args for details on what
Chrome can and cannot control via flags.
§Example
use stygian_browser::BrowserConfig;
use stygian_browser::tls::CHROME_131;
let cfg = BrowserConfig::builder()
.tls_profile(&CHROME_131)
.build();
// Chrome 131 supports both TLS 1.2 and 1.3 — no extra flags needed.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 proxy_source(self, source: Arc<dyn ProxySource>) -> Self
pub fn proxy_source(self, source: Arc<dyn ProxySource>) -> Self
Set a dynamic proxy source for per-instance proxy rotation.
Each new browser launched by the pool calls
ProxySource::bind_proxy to
acquire a URL and hold a circuit-breaker lease for the browser’s
lifetime.
§Example
use std::sync::Arc;
use stygian_browser::BrowserConfig;
// With stygian_proxy (compile stygian-proxy with `browser` feature):
// let cfg = BrowserConfig::builder()
// .proxy_source(Arc::new(ProxyManagerBridge::new(manager)))
// .build();Sourcepub fn build(self) -> BrowserConfig
pub fn build(self) -> BrowserConfig
Build the final BrowserConfig.