go-pinger
A simple Go app to ping websites. This is a simple Go application to ping websites for fun 😀😉.
How it works
There is a CSV file ping_urls.csv
from which the application will read the list of urls to ping. For each url we will create a goroutine. After that, we will wait to receive channel messages from the goroutines.
Once we receive all the messages for the urls we will bulk insert the results into MongoDB a single document for each of the response of a url. We will be uploading the following data to MongoDB
- URL
- Error if any
- Time Taken To Complete The Request
- Http Status Code
How to run
- Clone the repo
git clone https://github.com/harishdurga/go-pinger
- Change directory
cd go-pinger
- Install dependencies
go install
- Set MongoDB URI. Ex: mongodb+srv://username:password@cluster0.bqers.mongodb.net/pinger?retryWrites=true&w=majority
export PINGER_MONGO_CONNECT_URI=
- Run
go run main.go