Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Concurrent URL Pinger

A high-performance Rust tool designed to ping multiple URLs concurrently. This project utilizes the Tokio runtime for asynchronous execution and the Reqwest library for handling HTTP requests.

🚀 Features

  • Asynchronous Concurrency: Pings multiple URLs simultaneously using tokio::task::spawn.
  • Latency Tracking: Measures and displays the time taken for each request (e.g., 200 OK (417.8867ms)).
  • File Input: Reads the target URLs from an external urls.txt file.
  • Rate Limiting: Employs a Semaphore to control the number of concurrent requests, preventing system overwhelm.
  • Robust Error Handling: Gracefully handles network errors and non-responsive URLs without crashing.
  • Status Reporting: Prints each URL's status code, latency, or a descriptive error message to the console.

🛠️ Prerequisites

Ensure you have the following installed on your system:

📦 Dependencies

The project relies on:

  • tokio: Asynchronous runtime for Rust.
  • reqwest: Ergonomic HTTP client for Rust.

🏃 Getting Started

  1. Clone the repository (if applicable) or navigate to the project directory:

    cd concurrent_url_pinger
  2. Prepare your URLs: Create a file named urls.txt in the root directory and add one URL per line:

    https://www.rust-lang.org
    https://www.google.com
    
  3. Build the project:

    cargo build
  4. Run the application:

    cargo run

📊 Sample Output

Pinging 11 URLs concurrently...
https://www.google.com -> 200 OK (712.2399ms)
https://www.github.com -> 200 OK (450.3848ms)
https://www.rust-lang.org -> 200 OK (2.4659965s)
https://invalid-url-example.com -> Error: error sending request for url...
Done!

⚙️ Configuration

You can adjust the concurrency limit in the main.rs file within the ping_urls call:

ping_urls(urls, 5).await; // Change '5' to your desired concurrency level

📝 Future Improvements

  • Retry Logic: Automatically retry failed requests.
  • Export Results: Save results to a CSV or JSON file.

📄 License

This project is open-source and available under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages