HTTP Ping?

Little things make me happy. I was going to learn Kotlin, but then I thought I would give Golang another Go! Kotlin is still on my list but right now I am having a bit of fun with Go.
It is remarkable be easy to get started with but I have only just scratched the surface of this language I think.
Using the first chapter of the book and the examples in it I finally hacked together the solution that had been bugging me for a while:
How to check internet connectivity without using PING. Ping is actually blocked in Jails, Zones, and in some VMs because you need raw access to the network device and this can cause security issues.
Any how I made a program that times the HTTP request and time to download a page. The data is discarded but the response time and the code is kept.
There would be multiple messages back and forth so it is hard to check the actual latency but it gives a pretty good indication to the health of the internet. Plus it will literally be able to be run anywhere.
I put it on my Github:
https://github.com/wilyarti/httping/blob/master/httping.go
Screenshot from 2017-12-14 21-53-12

Leave a comment

Your email address will not be published. Required fields are marked *