seleniumbase-rs-codec (library seleniumbase_rs_codec, in crates/codec of the
seleniumbase-rs-stealth
repository) holds the wire formats of the stealth layer. It is pure: no sockets,
no clock, no files, and #![forbid(unsafe_code)]. Every parser bounds its input
and returns an error for hostile or truncated bytes instead of panicking. The
measured browser table is embedded from src/measured/*.json; today it holds one
entry, Chrome 155.0.8059.40 on macOS. The guide that explains these formats is
Wire formats.
Depend on it#
The crate is not on crates.io. Cargo finds it inside the repository by its package name:
Write seleniumbase-rs by its plain git URL, as above (no branch, tag or
rev): the codec takes the core the same way, so Cargo resolves both to one
commit and types such as OsType and ClientHints match. Its other
dependencies are ring, serde, serde_json and thiserror; there is no
BoringSSL here.
Features#
Turns on the ClientHello byte builders of the tests
(client_hello::fixtures, hidden from the documentation), for the tests of the
crates built on this one. Test support only: no release build turns it on. The
crate has no default features.
Default: "off"
Module map#
| Module | What it holds | Page |
|---|---|---|
emulation | The measured browser tables, embedded from JSON, and their lookups. | Emulation |
client_hello | The TLS ClientHello parser, ext_id constants and GREASE helpers. | ClientHello |
ja3, ja3::peetprint | JA3 and the peetprint, parsed, rendered and hashed. | JA3 and peetprint |
ja4 | JA4, JA4_o, JA4_r and JA4_ro. | JA4 |
akamai | Akamai HTTP/2 fingerprint strings. | Akamai |
h2_frames, h2_frames::hpack, h2_frames::huffman | HTTP/2 frame reading, the client preface, HPACK and Huffman decoding. | HTTP/2 frames |
tls_spec | The TLS profile a client must send, and the custom JA3, JA4 and peetprint overlays. | TlsSpec |
h2_spec | The HTTP/2 profile: SETTINGS, window, PRIORITY, pseudo-header order. | H2Spec |
header_spec | Header names, order and values per request shape. | HeaderSpec |
ids | IANA names of TLS and HTTP/2 ids, and what BoringSSL can emit. | Registries |
Re-exports at the root#
The main types are re-exported, so seleniumbase_rs_codec::Ja4 is
seleniumbase_rs_codec::ja4::Ja4. Two enums are both called SpecError in their
modules, and three lookups of emulation have short names, so they are renamed:
| Root name | Item |
|---|---|
Akamai, AkamaiError | akamai::Akamai, akamai::AkamaiError |
ClientHello, ClientHelloError | client_hello::ClientHello, client_hello::ClientHelloError |
Emulation, EmulationError | emulation::Emulation, emulation::EmulationError |
measured_emulations | emulation::measured |
emulation_for_kind | emulation::for_kind |
get_emulation | emulation::get |
H2Spec, H2SpecError | h2_spec::H2Spec, h2_spec::SpecError |
HeaderIdentity, HeaderSpec, HeaderSpecError, RequestShape | the header_spec items of the same name |
Ja3, Ja3Error, Peetprint, PeetprintError | ja3::Ja3, ja3::Ja3Error, ja3::peetprint::Peetprint, ja3::peetprint::PeetprintError |
Ja4, Ja4Error, Ja4Raw | the ja4 items of the same name |
KnownGap, TlsSpec, TlsSpecError | tls_spec::KnownGap, tls_spec::TlsSpec, tls_spec::SpecError |
emulation::SpecError is a type alias of EmulationError.
BrowserKind#
enum
A browser whose wire behaviour the measured tables describe. It is defined at the
crate root and has no serde of its own: the measured JSON spells it Chrome, and
the identity file of the scrape crate spells it chrome.
The enum is #[non_exhaustive]: match it with a wildcard arm. Every variant has
a measured entry; a unit test of the crate fails when one is added without a
measurement.
Sub-pages#
The measured tables: Emulation, Provenance, get, get_version, measured.
Parse the first TLS handshake message, across records.
Ja3, Peetprint, Slot, MD5 helpers.
Ja4, Ja4Raw, Ja4Facts, Ja4Diff.
The HTTP/2 fingerprint string: Akamai, PriorityFrame, Pseudo.
read_preface, PrefaceReader, HpackDecoder, Huffman.
The TLS profile, its reproducibility check and the overlays.
The HTTP/2 profile and what the wreq stack can send.
Header lists, placeholders and the priority table.