1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//! Cloudflare Turnstile bypass for `zendriver`.
//!
//! See the [Cloudflare chapter](https://turtiesocks.github.io/zendriver-rs/cloudflare.html)
//! of the [zendriver-rs user guide](https://turtiesocks.github.io/zendriver-rs/)
//! for end-to-end usage, timeout tuning, and detection-failure diagnostics.
//!
//! **Stealth recommended.** Cloudflare Turnstile is somewhat forgiving of
//! non-stealth Chrome, but `BrowserBuilder::stealth` significantly raises
//! the clearance success rate.
//!
//! Drives the Turnstile checkbox click flow:
//!
//! 1. Detect the Turnstile iframe via a shadow-DOM-aware walk of the page's
//! main world.
//! 2. Dispatch a raw left-click at the 15% × 50% offset inside the iframe
//! bbox (the canonical Turnstile checkbox location).
//! 3. Poll for either the `cf-turnstile-response` input gaining a token, or
//! the challenge container disappearing entirely.
//!
//! Most users go through `zendriver`'s `Tab::cloudflare()` (feature-gated)
//! rather than constructing the bypass directly. The
//! [`CloudflareBypass`] type is the underlying driver.
//!
//! ```no_run
//! # async fn ex(tab: &zendriver_transport::SessionHandle)
//! # -> Result<(), zendriver_cloudflare::CloudflareError> {
//! use std::time::Duration;
//! use zendriver_cloudflare::{CloudflareBypass, ClearanceOutcome};
//!
//! let outcome = CloudflareBypass::new(tab)
//! .wait_for_clearance(Duration::from_secs(30))
//! .await?;
//! match outcome {
//! ClearanceOutcome::TokenAcquired(token) => println!("got token: {token}"),
//! ClearanceOutcome::ChallengeGone => println!("challenge cleared"),
//! ClearanceOutcome::TimedOut { saw_challenge } => {
//! println!("timed out; saw_challenge = {saw_challenge}")
//! }
//! }
//! # Ok(()) }
//! ```
pub use ;
pub use CloudflareError;