Crate ua
Expand description
User Agent (UA) parser and profiles.
This crate provides a parser (UserAgent::new) for User Agents
as well as a classifier (UserAgentClassifierLayer in rama_http) that can be used to
classify incoming requests based on their User Agent (header).
These can be used to know what UA is connecting to a server, but it can also be used to emulate the UA from a client via the profiles that are found in this crate as well, be it builtin modules or custom ones.
Learn more about User Agents (UA) and why Rama supports it at https://ramaproxy.org/book/intro/user_agent.html.
§Emulation
Check out the emulate module for user-agent emulation or learn more about it at https://ramaproxy.org/book/intro/user_agent.html#user-agent-emulation.
§Rama
Crate used by the end-user rama crate and rama crate authors alike.
Learn more about rama:
- Github: https://github.com/plabayo/rama
- Book: https://ramaproxy.org/book/
§Remarks
We classify only the majority User Agents, and we do not classify all User Agents:
- All Chromium User Agents are classified as
UserAgentKind::Chromium(including Google Chrome); - All Firefox User Agents are classified as
UserAgentKind::Firefox; - All Safari User Agents are classified as
UserAgentKind::Safari;
The only Platforms recognised are Windows,
MacOS, Linux,
Android, and iOS.
User Agent versions are parsed only their most significant version number (e.g. 124 for Chrome/124.0.0
and 1704 for Safari Version/17.4). We do not parse the version for platforms as
these are no longer advertised in contemporary User Agents. Nor do we currently use these versions
for UA profile selection.
For UA Classification one can overwrite the HttpAgent and TlsAgent advertised by the UserAgent,
using the UserAgent::with_http_agent and UserAgent::with_tls_agent methods.
Please open an issue in case you need support for more User Agents, and have a good case to make for it. For example we might also support the default user agents used by mobile application SDKs. This makes however only sense if we can provide Http and Tls emulation for it. Also contributions are welcome in case you think we can improve or expand our data coverage for each profile.
Modules§
Structs§
- User
Agent - User Agent (UA) information.
- User
Agent Info - Information about the
UserAgent - User
Agent Overwrites - Information that can be used to overwrite the
UserAgentof an http request.
Enums§
- Device
Kind - Device on which the
UserAgentoperates. - Http
Agent - Http implementation used by the
UserAgent - Platform
Kind - Platform within the
UserAgentoperates. - TlsAgent
- Tls implementation used by the
UserAgent - User
Agent Kind - The kind of
UserAgent