Expand description
§mimic-rs
High-performance User-Agent to Sec-CH-UA Client Hints converter.
This crate provides functionality to parse User-Agent strings and generate corresponding Sec-CH-UA (Client Hints) headers as used by Chromium-based browsers.
§Features
- Zero-copy parsing where possible
- Support for Chrome, Edge, Brave, Opera, and other Chromium-based browsers
- Accurate greased brand generation matching Chromium’s algorithm
- Platform and mobile detection
- Optional serde support
§Example
use mimic_rs::ClientHints;
let ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36";
let hints = ClientHints::from_ua(ua).unwrap();
println!("sec-ch-ua: {}", hints.sec_ch_ua());
println!("sec-ch-ua-mobile: {}", hints.sec_ch_ua_mobile());
println!("sec-ch-ua-platform: {}", hints.sec_ch_ua_platform());Structs§
- Client
Hints - Client Hints generated from a User-Agent string.
Enums§
- Brand
- Supported browser brands.
- Parse
Error - Error type for User-Agent parsing failures.
- Platform
- Represents the platform/operating system.