Skip to main content

http_quik/
lib.rs

1//! # http-quik: High-Fidelity stealth transport engine
2//!
3//! `http-quik` is a specialized HTTP transport library designed for absolute network identity parity
4//! with Google Chrome. It provides low-level control over the entire protocol stack—from TLS
5//! handshakes to HTTP/2 frame signaling—to ensure that every network interaction is
6//! indistinguishable from a real browser.
7//!
8//! This crate is a core component of the [Phantom Engine](https://github.com/polymit/phantom-engine)
9//! ecosystem and provides the high-stealth transport layer required for modern agentic navigation.
10//!
11//! ## Why http-quik?
12//! Modern Anti-Bot systems (like Cloudflare, Akamai, and DataDome) use "Passive Fingerprinting"
13//! to identify automated traffic. They inspect:
14//! 1. **TLS Fingerprint (JA3/JA4)**: The order of cipher suites, extensions, and elliptic curves.
15//! 2. **HTTP/2 Fingerprint (Akamai)**: The SETTINGS frame values, the order of pseudo-headers, and stream priority.
16//!
17//! `http-quik` solves this by using a custom BoringSSL stack and a specialized HTTP/2 builder to replicate
18//! these fingerprints with bit-perfect accuracy.
19//!
20//! ## Core Features
21//! - **BoringSSL Integration**: Full control over ClientHello, including GREASE and extension permutation.
22//! - **Chrome 134 Identity**: Pre-configured profiles for the latest Chrome stable releases.
23//! - **Connection Pooling**: Managed H2 session reuse to maintain consistent behavioral fingerprints.
24//! - **Stealth Redirects**: A redirect state machine that handles `sec-fetch-*` headers and method rotation identical to Chromium.
25//!
26//! ## Getting Started
27//!
28//! ```rust
29//! use http_quik::{Client, ChromeProfile, Platform};
30//!
31//! #[tokio::main]
32//! async fn main() -> Result<(), http_quik::Error> {
33//!     // Create a client with a macOS Chrome 134 identity
34//!     let client = Client::builder()
35//!         .profile(http_quik::profile::chrome_134::profile(Platform::MacOsArm))
36//!         .build()?;
37//!
38//!     // Execute a stealth request
39//!     let response = client.get("https://example.com").await?;
40//!     println!("Status: {}", response.status());
41//!     
42//!     Ok(())
43//! }
44//! ```
45//!
46//! ## Safety & FFI
47//! This crate uses `boring` and `boring-sys` for low-level TLS control. All unsafe blocks are
48//! localized to the `tls` and `client` modules and are documented with safety rationales.
49//!
50//! ## Changelog
51//! For recent updates and release notes, please see the [CHANGELOG.md](https://github.com/polymit/quik/blob/main/CHANGELOG.md) on GitHub.
52
53pub mod client;
54pub mod error;
55
56/// Low-level HTTP/2 frame and builder configuration.
57///
58/// This module provides internal utilities for overriding the default H2 handshake
59/// to match Chromium's behavioral markers.
60pub(crate) mod http2;
61
62pub mod profile;
63
64/// TLS connector construction and FFI bindings for BoringSSL.
65///
66/// Handles the bit-perfect replication of Chrome's TLS handshake, including
67/// post-quantum key shares and extension permutation.
68pub(crate) mod tls;
69
70pub use crate::client::{connect, Client, ClientBuilder, Response};
71pub use crate::error::{Error, Result};
72pub use crate::profile::chrome_134::AKAMAI_FINGERPRINT;
73pub use crate::profile::chrome_134::JA3_HASH;
74pub use crate::profile::{ChromeProfile, Platform};