pub enum UpstreamClient {
Reqwest(Client),
}Expand description
Either the default reqwest client or a stealth (wreq) client,
optionally wearing a different browser fingerprint per request via
the UpstreamClient::StealthPool variant.
Variants§
Reqwest(Client)
Default rustls-backed reqwest client. Carries SSRF resolver, redirect policy, proxy-pool, etc.
Implementations§
Source§impl UpstreamClient
impl UpstreamClient
Sourcepub fn from_reqwest(client: Client) -> Self
pub fn from_reqwest(client: Client) -> Self
Build the default reqwest variant from a pre-configured client.
All the SSRF/resolver/cookie wiring stays where it already is in
main(); this is just the wrapping ctor.
Sourcepub fn stealth(_profile: ImpersonateProfile) -> Result<Self, UpstreamError>
pub fn stealth(_profile: ImpersonateProfile) -> Result<Self, UpstreamError>
Build a stealth variant wearing the given browser profile.
§Errors
Returns UpstreamError::StealthFeatureDisabled if the binary
was built without tls-impersonate.
Sourcepub fn stealth_pool(
_profiles: &[ImpersonateProfile],
) -> Result<Self, UpstreamError>
pub fn stealth_pool( _profiles: &[ImpersonateProfile], ) -> Result<Self, UpstreamError>
Build a rotating pool of stealth clients (one per profile).
send() advances a round-robin cursor so successive requests
land on different fingerprints.
§Errors
UpstreamError::StealthFeatureDisabledif built withouttls-impersonate.UpstreamError::Requestif any client fails to build OR if_profilesis empty (a pool of zero is meaningless).
Sourcepub async fn send(
&self,
method: &str,
url: &str,
headers: &[(String, String)],
body: Option<Vec<u8>>,
max_body: usize,
) -> Result<UpstreamResponse, UpstreamError>
pub async fn send( &self, method: &str, url: &str, headers: &[(String, String)], body: Option<Vec<u8>>, max_body: usize, ) -> Result<UpstreamResponse, UpstreamError>
Send a request and read the response (with body bounded by
max_body). Method/URL/headers/body shape mirrors what
forward_wafrift_request already builds — the migration is just
“stop calling client.request(method, url).send() directly,
call this instead”.
§Body bounding
Bodies are truncated at max_body bytes (no error, the
truncated content is still useful for WAF-block detection —
matches forward_wafrift_request’s existing semantics).
Sourcepub fn tls_stack_name(&self) -> &'static str
pub fn tls_stack_name(&self) -> &'static str
Returns the operator-visible name of the active TLS stack, for
log lines / /_wafrift/status output.
Trait Implementations§
Source§impl Clone for UpstreamClient
impl Clone for UpstreamClient
Source§fn clone(&self) -> UpstreamClient
fn clone(&self) -> UpstreamClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for UpstreamClient
impl !UnwindSafe for UpstreamClient
impl Freeze for UpstreamClient
impl Send for UpstreamClient
impl Sync for UpstreamClient
impl Unpin for UpstreamClient
impl UnsafeUnpin for UpstreamClient
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more