pub struct ProxyConfiguration { /* private fields */ }Expand description
Static, custom, or per-domain tiered proxy selection.
use millipede_core::proxy::ProxyConfiguration;
let config = ProxyConfiguration::round_robin([url::Url::parse("http://proxy.example")?]);
assert!(format!("{config:?}").contains("Static"));Implementations§
Source§impl ProxyConfiguration
impl ProxyConfiguration
Sourcepub fn round_robin(urls: impl IntoIterator<Item = Url>) -> Self
pub fn round_robin(urls: impl IntoIterator<Item = Url>) -> Self
Creates a round-robin static list.
Sourcepub fn rotating(
urls: impl IntoIterator<Item = Url>,
rotation: RotationStrategy,
) -> Self
pub fn rotating( urls: impl IntoIterator<Item = Url>, rotation: RotationStrategy, ) -> Self
Creates a static list using rotation.
Sourcepub fn custom<R: ProxyResolver>(resolver: R) -> Self
pub fn custom<R: ProxyResolver>(resolver: R) -> Self
Creates a configuration backed by a custom resolver.
Sourcepub fn tiered(tiers: Vec<Vec<Option<Url>>>) -> Self
pub fn tiered(tiers: Vec<Vec<Option<Url>>>) -> Self
Creates tiered rotation with a probe every 20 requests.
Sourcepub fn tiered_with_probe_interval(
tiers: Vec<Vec<Option<Url>>>,
probe_interval: u32,
) -> Self
pub fn tiered_with_probe_interval( tiers: Vec<Vec<Option<Url>>>, probe_interval: u32, ) -> Self
Creates tiered rotation with the requested probe interval.
Sourcepub async fn new_url(
&self,
ctx: ProxyResolveContext<'_>,
) -> Result<Option<Url>, CrawlError>
pub async fn new_url( &self, ctx: ProxyResolveContext<'_>, ) -> Result<Option<Url>, CrawlError>
Selects the next proxy URL, or None for a direct request.
Sourcepub async fn new_proxy_info(
&self,
ctx: ProxyResolveContext<'_>,
) -> Result<Option<ProxyInfo>, CrawlError>
pub async fn new_proxy_info( &self, ctx: ProxyResolveContext<'_>, ) -> Result<Option<ProxyInfo>, CrawlError>
Selects and parses the next proxy, retaining tier and session metadata.
Sourcepub fn report_blocked(&self, target: &Url)
pub fn report_blocked(&self, target: &Url)
Reports that target was blocked, escalating its domain unless a recovery probe failed.
Sourcepub fn report_success(&self, target: &Url)
pub fn report_success(&self, target: &Url)
Reports success for target, accepting a pending lower-tier recovery probe.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ProxyConfiguration
impl !RefUnwindSafe for ProxyConfiguration
impl !UnwindSafe for ProxyConfiguration
impl Send for ProxyConfiguration
impl Sync for ProxyConfiguration
impl Unpin for ProxyConfiguration
impl UnsafeUnpin for ProxyConfiguration
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