| Crates.io | rand_agents |
| lib.rs | rand_agents |
| version | 1.0.0 |
| created_at | 2025-01-17 06:26:04.11268+00 |
| updated_at | 2025-01-17 06:26:04.11268+00 |
| description | A Rust library for generating random user agent strings. |
| homepage | |
| repository | https://github.com/TrixSec/rand_agents |
| max_upload_size | |
| id | 1520346 |
| size | 11,426 |
Current Version: 1.0.0
Author: Trix Cyrus
Copyright: © 2025 Trixsec Org
Maintained: Yes
rand_agents is a Rust library for generating random user agent strings. It can be used in any Rust project to easily create random user agents for web scraping, testing, or security purposes.
To use rand_agents in your Rust project, follow these steps:
rand_agents to Cargo.tomlIn your Rust project's Cargo.toml file, add the following line under [dependencies]:
[dependencies]
rand_agents = "1.0.0" }
rand_agents in Your CodeIn your main.rs (or any other Rust file), add the following code to generate a random user agent:
use rand_agents::user_agent;
fn main() {
let user_agent = user_agent();
println!("Random User Agent: {}", user_agent);
}
This will generate and print a random user agent string to the console.
To run your project, simply use:
cargo run
You should see a randomly generated user agent string.
Random User Agent: Opera/9.27 (Raspbian; Apple MacBook Pro) AppleWebKit/619.1.22 (KHTML, like Gecko) RockMelt/75.0.406 Safari/619.1.22