Crate rand_user_agent

Source
Expand description

This is a program that randomly generates UserAgents. [这是一个随机生成UserAgent的程序] 数据整理自: whatmyuseragent.com user-agents.net useragentstring.com

§Quick Start

   // one
   println!("{}", UserAgent::random().to_string());
   // two
   UserAgent::custom(rand::random(), rand::random());   

§Mobile and computer designated.[手机电脑指定]

   // Random mobile agent. [随机手机端agent]
   println!("Mobile:{}", UserAgent::mobile().to_string());
   // Random Desktop agent.随机PC端
   println!("Pc:{}", UserAgent::pc().to_string());

§Fully customizable.完全自定义

let mut rng = rand::thread_rng();
println!(
    "custom Mobile Iphone Chrome:{}",
    UserAgent::custom(Devices::Mobile(MobileDevice::Iphone), Browser::Chrome)
);
println!(
    "custom Desktop Windows random browser :{}",
    UserAgent::custom(Devices::Desktop(DesktopDevice::Windows), rand::random())
);
println!(
    "custom random Mobile & random browser :{}",
    UserAgent::custom(Devices::Mobile(rand::random()), Browser::random(&mut rng))
);
//Devices、Browser、DesktopDevice、MobileDevice impl rand::distributions::Standard
let mut rng = rand::thread_rng();
UserAgent::custom(Devices::random(&mut rng), Browser::random(&mut rng));
UserAgent::custom(rand::random(), rand::random());

§Todo

  • create Sec-CH-UA

Structs§

UserAgent
用户代理生成

Enums§

Browser
IEnternetExplorer I won’t support it
DesktopDevice
Devices
MobileDevice