pub struct JavascriptV2Solver { /* private fields */ }Expand description
Solver capable of handling Cloudflare VM (v2) JavaScript challenges.
Implementations§
Source§impl JavascriptV2Solver
impl JavascriptV2Solver
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a solver with default delay range (1-5 seconds) and no captcha provider.
Sourcepub fn with_delay_range(self, min: Duration, max: Duration) -> Self
pub fn with_delay_range(self, min: Duration, max: Duration) -> Self
Configure the random delay range applied before challenge submission.
Sourcepub fn with_captcha_provider(self, provider: Arc<dyn CaptchaProvider>) -> Self
pub fn with_captcha_provider(self, provider: Arc<dyn CaptchaProvider>) -> Self
Attach an hCaptcha provider that will be used when captcha challenges are detected.
Sourcepub fn set_captcha_provider(&mut self, provider: Arc<dyn CaptchaProvider>)
pub fn set_captcha_provider(&mut self, provider: Arc<dyn CaptchaProvider>)
Set (or replace) the captcha provider after construction.
Sourcepub fn clear_captcha_provider(&mut self)
pub fn clear_captcha_provider(&mut self)
Remove any configured captcha provider.
Sourcepub fn is_js_challenge(response: &ChallengeResponse<'_>) -> bool
pub fn is_js_challenge(response: &ChallengeResponse<'_>) -> bool
Returns true when the response matches the Cloudflare v2 JavaScript challenge signature.
Sourcepub fn is_captcha_challenge(response: &ChallengeResponse<'_>) -> bool
pub fn is_captcha_challenge(response: &ChallengeResponse<'_>) -> bool
Returns true when the response corresponds to the Cloudflare v2 hCaptcha flow.
Sourcepub fn solve(
&self,
response: &ChallengeResponse<'_>,
) -> Result<ChallengeSubmission, JavascriptV2Error>
pub fn solve( &self, response: &ChallengeResponse<'_>, ) -> Result<ChallengeSubmission, JavascriptV2Error>
Build the challenge submission payload for non-captcha VM challenges.
Sourcepub async fn solve_with_captcha(
&self,
response: &ChallengeResponse<'_>,
) -> Result<ChallengeSubmission, JavascriptV2Error>
pub async fn solve_with_captcha( &self, response: &ChallengeResponse<'_>, ) -> Result<ChallengeSubmission, JavascriptV2Error>
Build the challenge submission payload for captcha-protected VM challenges.
Sourcepub async fn solve_and_submit(
&self,
client: Arc<dyn ChallengeHttpClient>,
response: &ChallengeResponse<'_>,
original_request: OriginalRequest,
) -> Result<ChallengeHttpResponse, JavascriptV2Error>
pub async fn solve_and_submit( &self, client: Arc<dyn ChallengeHttpClient>, response: &ChallengeResponse<'_>, original_request: OriginalRequest, ) -> Result<ChallengeHttpResponse, JavascriptV2Error>
Execute the full challenge flow, including waiting and submission.
Trait Implementations§
Source§impl ChallengeSolver for JavascriptV2Solver
impl ChallengeSolver for JavascriptV2Solver
Auto Trait Implementations§
impl Freeze for JavascriptV2Solver
impl !RefUnwindSafe for JavascriptV2Solver
impl Send for JavascriptV2Solver
impl Sync for JavascriptV2Solver
impl Unpin for JavascriptV2Solver
impl !UnwindSafe for JavascriptV2Solver
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
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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.