Expand description
Proxy source port for browser context pools.
This module provides the ProxySource and ProxyLease traits that
decouple stygian-browser from any concrete proxy implementation. The
browser crate owns the trait definitions; stygian-proxy implements them.
Wire in a real proxy pool by setting BrowserConfigBuilder::proxy_source to an
Arc<dyn ProxySource>. stygian-proxy provides a ready-made
implementation via ProxyManagerBridge when compiled with its browser
feature.
§Example
use std::sync::Arc;
use async_trait::async_trait;
use stygian_browser::proxy::{ProxyLease, ProxySource, DirectLease};
use stygian_browser::error::Result;
#[derive(Debug)]
struct StaticProxy {
url: String,
}
#[async_trait]
impl ProxySource for StaticProxy {
async fn bind_proxy(&self) -> Result<(String, Box<dyn ProxyLease>)> {
Ok((self.url.clone(), Box::new(DirectLease)))
}
}
let cfg = stygian_browser::BrowserConfig::builder()
.proxy_source(Arc::new(StaticProxy { url: "http://proxy.example.com:8080".into() }))
.build();Structs§
- Direct
Lease - A no-op
ProxyLeasefor use when no proxy is configured.
Traits§
- Proxy
Lease - RAII guard for a proxy acquired from a
ProxySource. - Proxy
Source - Source of proxies for browser context pools.