Skip to main content

specter/
lib.rs

1//! # Specter
2//!
3//! HTTP client with full TLS/HTTP2 fingerprint control.
4//!
5//! Specter provides HTTP/1.1, HTTP/2, and HTTP/3 support with BoringSSL-based
6//! TLS fingerprinting (JA3/JA4) across all protocols.
7
8// Opt-in mimalloc as the global allocator. Enabled via the `mimalloc`
9// feature; ships off by default so the system allocator continues to
10// govern downstream consumers that do not opt in.
11#[cfg(feature = "mimalloc")]
12#[global_allocator]
13static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
14
15// Core modules
16pub mod auth;
17pub mod cache;
18pub mod cookie;
19pub mod error;
20#[cfg(feature = "grpc")]
21pub mod grpc;
22pub mod headers;
23pub mod request;
24pub mod response;
25pub mod timeouts;
26pub mod url;
27pub mod version;
28pub mod websocket;
29
30// Fingerprinting
31pub mod fingerprint;
32
33// Transport layer
34pub mod transport;
35
36// Connection pooling
37pub mod pool;
38
39// Re-exports for convenient access
40pub use cookie::{hash_cookie_value, CookieJar};
41pub use error::{Error, Result};
42pub use fingerprint::{FingerprintProfile, PriorityTree};
43#[cfg(feature = "grpc")]
44pub use grpc::{encode_message, GrpcEncoding, GrpcFramer};
45pub use headers::Headers;
46pub use headers::HeadersBuilder;
47pub use headers::OrderedHeaders;
48pub use request::{IntoUrl, RedirectPolicy, Request, RequestBody, RequestBodyStream};
49pub use response::{Body, Response};
50pub use timeouts::{recv_with_idle_timeout, Timeouts};
51pub use url::Url;
52pub use version::HttpVersion;
53pub use websocket::{
54    CloseCode, CloseFrame, Message, PreparedMessage, WebSocket, WebSocketBuilder, WebSocketConfig,
55    WebSocketError, WebSocketFrame, WebSocketFrameOpcode, WebSocketReader, WebSocketResult,
56    WebSocketWriter,
57};
58
59// Transport re-exports
60pub use transport::connector::{AlpnProtocol, BoringConnector, MaybeHttpsStream};
61pub use transport::dns::{DnsConfig, Resolve, ResolveFuture};
62pub use transport::h1::H1Connection;
63pub use transport::h1_h2::{
64    CapacityPolicy, Client, ClientBuilder, RequestBuilder, WebSocketH3Builder,
65};
66pub use transport::h2::{H2ClientBuilder, H2Connection, H2PooledConnection, PseudoHeaderOrder};
67pub use transport::h3::{H3Backend, H3Client, H3TransportConfig, H3Tunnel, H3TunnelEvent};
68pub use transport::session::SessionCache;
69pub use transport::tcp::{TcpFingerprint, TcpSocketBuffers};
70
71// Pool re-exports
72pub use pool::alt_svc::{AltSvcCache, AltSvcEntry};
73pub use pool::multiplexer::{ConnectionPool, PoolEntry, PoolKey};