Skip to main content

ClientBuilder

Struct ClientBuilder 

Source
pub struct ClientBuilder { /* private fields */ }
Expand description

Builder for Client.

Implementations§

Source§

impl ClientBuilder

Source

pub fn timeout(self, timeout: Duration) -> Self

Per-request timeout (covers connect, headers, and body read).

Source

pub fn connect_timeout(self, timeout: Duration) -> Self

TCP-connect timeout, applied independently of the request timeout.

Source

pub fn user_agent(self, user_agent: impl Into<String>) -> Self

Override the User-Agent header sent on every request.

Source

pub fn follow_redirects(self, follow: bool) -> Self

Toggle automatic redirect following. Defaults to true; disable when using crate::Signal::RedirectAbsent is undesirable for a run.

Source

pub fn min_request_interval(self, interval: Duration) -> Self

Minimum time between consecutive requests to the same host.

Defaults to 100 ms (≈ 10 RPS per host) — enough headroom to avoid rate-limit responses on common OSINT targets while keeping fan-out across many sites fast.

Source

pub fn max_rps(self, rps: NonZeroU32) -> Self

Cap the total request rate across all hosts to rps requests per second. Independent of (and composed with) the per-host interval — useful on a metered connection or behind a shared-quota proxy. Uncapped by default.

Source

pub fn max_retries(self, n: u32) -> Self

Maximum retry attempts after a transient ban response. Defaults to 2 (so up to 3 total tries). Set to 0 to disable retry entirely.

Source

pub fn base_backoff_delay(self, d: Duration) -> Self

Base delay for the first retry. Subsequent retries double until reaching Self::max_backoff_delay. Defaults to 500 ms.

Source

pub fn max_backoff_delay(self, d: Duration) -> Self

Cap on a single backoff delay (pre-jitter). Defaults to 30 s.

Source

pub fn proxy(self, url: impl Into<String>) -> Self

Route all requests through a proxy. Accepts http://, https://, and socks5:// URLs. For Tor, pass socks5://127.0.0.1:9050.

Source

pub fn rotate_user_agents(self, agents: Vec<String>) -> Self

Rotate the User-Agent header per request, picking uniformly at random from agents. An empty list (the default) keeps the single fixed User-Agent. Useful for reducing trivial fingerprinting.

Source

pub fn enrich(self, enrich: bool) -> Self

Extract profile fields (per crate::Site::extract) from Found pages. Off by default; enables an extra body read for matching sites.

Source

pub fn respect_robots(self, respect: bool) -> Self

Honor each host’s robots.txt: probes to disallowed paths are skipped (reported Uncertain, note robots_disallowed). Off by default. Adds one cached robots.txt fetch per origin.

Source

pub fn browser(self, backend: Arc<dyn BrowserBackend>) -> Self

Attach a browser backend. Sites tagged bot-protected will be routed through it instead of the raw HTTP path, up to the browser_budget cap.

Source

pub const fn browser_budget(self, cap: usize) -> Self

Per-scan cap on how many bot-protected sites are allowed to use the browser backend. Once exhausted, the rest fall back to Uncertain(BrowserBudget). Defaults to DEFAULT_BROWSER_BUDGET.

Source

pub fn build(self) -> Result<Client>

Build a Client.

Trait Implementations§

Source§

impl Clone for ClientBuilder

Source§

fn clone(&self) -> ClientBuilder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ClientBuilder

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for ClientBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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