ICMP based Ping CLI application
The CLI application accepts a hostname or an IP address as its argument, then sends ICMP “echo requests”
in a loop to the target while receiving “echo reply” messages. It also reports loss and RTT times
for each sent message.
To run the application, use the following command: \sudo go run ping.go [-ttl=value] [-ipv6] host
ttl
- specify ttl value. If not specified, it shall default to 255.ipv6
- set this flag to specify IPv6 protocol. Otherwise, IPv4 is assumed.host
- either a hostname or ip address. Must correspond to the protocol specified.sudo go run src/ping.go -ttl=100 1.1.1.1
sudo go run src/ping.go -ttl=100 -ipv6 ipv6.google.com
In order for Ping to work it needs to be able to create a raw network socket. This is typically a privileged action
Therefore, administrator privileges required. Must use sudo
.