Skip to main content

nab/
lib.rs

1//! `nab` - Ultra-minimal browser engine
2//!
3//! # Features
4//!
5//! - **HTTP Acceleration**: HTTP/2 multiplexing, TLS 1.3, Brotli/Zstd compression
6//! - **Browser Fingerprinting**: Realistic Chrome/Firefox/Safari profiles
7//! - **Authentication**: 1Password CLI integration, cookie extraction
8//! - **JavaScript**: `QuickJS` engine with minimal DOM
9//!
10//! # Example
11//!
12//! ```rust,no_run
13//! use nab::AcceleratedClient;
14//!
15//! #[tokio::main]
16//! async fn main() -> anyhow::Result<()> {
17//!     let client = AcceleratedClient::new()?;
18//!     let html = client.fetch_text("https://example.com").await?;
19//!     println!("Fetched {} bytes", html.len());
20//!     Ok(())
21//! }
22//! ```
23
24pub mod error;
25
26/// Internal implementation modules — not stable public API.
27#[doc(hidden)]
28pub mod analyze;
29/// Internal implementation modules — not stable public API.
30#[doc(hidden)]
31pub mod annotate;
32pub mod api_discovery;
33pub mod arena;
34pub mod auth;
35#[cfg(feature = "browser")]
36pub mod browser;
37pub mod browser_detect;
38pub mod content;
39/// Internal implementation modules — not stable public API.
40#[doc(hidden)]
41pub mod fetch_bridge;
42pub mod fingerprint;
43pub mod form;
44pub mod http3_client;
45pub mod http_client;
46#[cfg(feature = "impersonate")]
47pub mod impersonate_client;
48/// Internal implementation modules — not stable public API.
49#[doc(hidden)]
50pub mod js_engine;
51pub mod login;
52pub mod mfa;
53pub mod plugin;
54pub mod prefetch;
55pub mod rate_limit;
56pub mod session;
57pub mod site;
58pub mod ssrf;
59pub mod stream;
60pub mod websocket;
61
62pub use error::NabError;
63
64pub use api_discovery::{ApiDiscovery, ApiEndpoint};
65pub use auth::{
66    CookieSource, Credential, CredentialRetriever, CredentialSource, OnePasswordAuth, OtpCode,
67    OtpRetriever, OtpSource,
68};
69#[cfg(feature = "browser")]
70pub use browser::{BrowserLogin, Cookie};
71pub use browser_detect::{BrowserType, detect_default_browser};
72pub use fingerprint::{
73    BrowserProfile, chrome_profile, firefox_profile, random_profile, safari_profile,
74};
75pub use form::{Form, parse_field_args};
76pub use http_client::{AcceleratedClient, SafeFetchConfig, SafeFetchResponse};
77pub use http3_client::Http3Client;
78#[cfg(feature = "http3")]
79pub use http3_client::Http3Response;
80pub use login::{LoginFlow, LoginResult, get_session_dir};
81pub use mfa::{MfaHandler, MfaResult, MfaType, NotificationConfig, detect_mfa_type};
82pub use prefetch::{EarlyHintLink, EarlyHints, PrefetchManager, extract_link_hints};
83pub use session::{MAX_SESSIONS, SessionStore};
84pub use ssrf::{
85    DEFAULT_MAX_BODY_SIZE, DEFAULT_MAX_REDIRECTS, extract_mapped_ipv4, is_denied_ipv4,
86    is_denied_ipv6, validate_ip, validate_redirect_target, validate_url,
87};
88pub use stream::{StreamBackend, StreamInfo, StreamProvider};
89pub use websocket::{JsonRpcWebSocket, WebSocket, WebSocketMessage};
90
91/// Version of nab
92pub const VERSION: &str = env!("CARGO_PKG_VERSION");