18 lines
626 B
Rust
18 lines
626 B
Rust
#[tokio::main]
|
|
async fn main() {
|
|
let mut handles = Vec::with_capacity(1000);
|
|
for url in include_str!("../test-urls.txt").split("\n") {
|
|
handles.push(tokio::spawn(async move {
|
|
match reqwest::ClientBuilder::new().user_agent("Test/contact: admin@cryto.net").build().unwrap().get(url).send().await.and_then(|resp| {
|
|
Ok(resp.status())
|
|
}) {
|
|
Ok(status) => println!("{}, {}", status, chrono::Utc::now()),
|
|
Err(_) => eprintln!("Something went wrong here"),
|
|
};
|
|
}));
|
|
}
|
|
for handle in handles {
|
|
handle.await;
|
|
}
|
|
}
|