Skip to main content

ProxyConfiguration

Struct ProxyConfiguration 

Source
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

Source

pub fn round_robin(urls: impl IntoIterator<Item = Url>) -> Self

Creates a round-robin static list.

Source

pub fn rotating( urls: impl IntoIterator<Item = Url>, rotation: RotationStrategy, ) -> Self

Creates a static list using rotation.

Source

pub fn custom<R: ProxyResolver>(resolver: R) -> Self

Creates a configuration backed by a custom resolver.

Source

pub fn tiered(tiers: Vec<Vec<Option<Url>>>) -> Self

Creates tiered rotation with a probe every 20 requests.

Source

pub fn tiered_with_probe_interval( tiers: Vec<Vec<Option<Url>>>, probe_interval: u32, ) -> Self

Creates tiered rotation with the requested probe interval.

Source

pub async fn new_url( &self, ctx: ProxyResolveContext<'_>, ) -> Result<Option<Url>, CrawlError>

Selects the next proxy URL, or None for a direct request.

Source

pub async fn new_proxy_info( &self, ctx: ProxyResolveContext<'_>, ) -> Result<Option<ProxyInfo>, CrawlError>

Selects and parses the next proxy, retaining tier and session metadata.

Source

pub fn report_blocked(&self, target: &Url)

Reports that target was blocked, escalating its domain unless a recovery probe failed.

Source

pub fn report_success(&self, target: &Url)

Reports success for target, accepting a pending lower-tier recovery probe.

Trait Implementations§

Source§

impl Debug for ProxyConfiguration

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more