A toy-clone of ping

Related tags

Command-line rong
Overview

Rong

Ping is a simple command that is used to check the liveness of a server. Ping measures the round-trip time for messages sent from the originating host to a destination computer that are echoed back to the source. The name comes from active sonar terminology that sends a pulse of sound and listens for the echo to detect objects under water. This is a toy version of that program.

Note

The idea for this toy implementation is that it should be easy to read and implement so we will avoid implementing a lot features and just do the bare minimum. One can go throught this readme and try to implement their own version for it. Maybe even add more feaures along the way.

Requirements

  • Understanding of IP (The layer-3 protocol)

Theory

Before delving into writing the toy clone for ping it is very important that we understand the mechnaisms that we have in place to make the Network layer work.

  • First we have the Internet Protocol
    • It deals with creation of IP datagrams
    • handles hop-by-hop delivery of these datagrams
  • Another thing we have in place are Routing Tables
    • which contain entries on what path to take and are filled using algorithms (e.g. Link-State, etc)
  • Lastly we have ICMP
    • it helps with error reporting
    • it helps with diagnoses of problems

What happens when we send the ECHO_REQUEST packet?

Looking at the Echo and Echo Reply section of the ICMP protocol specification we can see a way that can help us develop what we set out to do.

  • Hop-by-hop this packet will reach the destination
  • The destination will read this message and reply with an ECHO_REPLY
  • Hop-by-hop this reaches us back

High level overview

  • Create an ECHO_REQUEST packet
  • Put this packet in an IP datagram
  • Start a timer
  • Send this packet to the destination
  • Receive the ECHO_REPLY packet sent by the destination
  • Stop the timer
  • Calculate the elpased time

Execution

./run.sh --url=<ipv4 address of the destination>

Note: In order to keep the code simple we don't do dns resolution so it expects an ipv4 address and not a url.

You might also like...
Wordlet - a command line clone of Wordle, written in Rust.
Wordlet - a command line clone of Wordle, written in Rust.

Wordlet Wordlet is a command line clone of Wordle, written in Rust. Installation $ cargo install wordlet Usage After installation, start Wordlet by ty

xcp is a (partial) clone of the Unix cp command. It is not intended as a full replacement

xcp is a (partial) clone of the Unix cp command. It is not intended as a full replacement, but as a companion utility with some more user-friendly feedback and some optimisations that make sense under certain tasks (see below).

A clone of linux cal command, using rust programming language

CLI Calendar command What the project does This command was inspired by Linux Cal command that shows the current month calendar as output (by default)

A minecraft clone made in Rust - WIP
A minecraft clone made in Rust - WIP

unsafe {} A minecraft clone made in Rust. The world is infinite in all three directions. DISCLAIMER: Some textures are stolen from the chisel mod HEAV

A simple cli to clone projects and fetch all projects in a GitHub org..

stupid-git A simple cli to clone projects and update all projects. get all repository from GitHub clone all pull all with git stash Usage create sgit.

rust cli project.el clone for those leaving emacs

R-Ject I was a longtime Emacs user and really miss the project management that came with projectile.el and project.el at the same time I was looking f

My own image file format created for fun! Install the "hif_opener.exe" to open hif files. clone the repo and compile to make your own hif file

Why am i creating this? I wanted to create my own image format since I was 12 years old using Windows 7, tryna modify GTA San Andreas. That day, when

Planetoid is a toy project to demonstrate and learn several technologies. The goal is to create a little multiplayer asteriod game clone.
Planetoid is a toy project to demonstrate and learn several technologies. The goal is to create a little multiplayer asteriod game clone.

Planetoid is a toy project to demonstrate and learn several technologies. The goal is to create a little multiplayer asteriod game clone.

Sōzu HTTP reverse proxy, configurable at runtime, fast and safe, built in Rust. It is awesome! Ping us on gitter to know more

Sōzu · Sōzu is a lightweight, fast, always-up reverse proxy server. Why use Sōzu? Hot configurable: Sozu can receive configuration changes at runtime

A prettier lightweight colored ping utility written in Rust

rustyping A prettier lightweight colored ping utility written in Rust. Installation There are three installation options: From the releases page From

Simple utility to ping a TCP port.

TcpPing Simple utility to ping a TCP port. Example tcpping 1.1.1.1 53 -b en0 -i 1 -t 4 Connected to 1.1.1.1:53 in 21 ms Connected to 1.1.1.1:53 in 3

Gping - Ping, but with a graph
Gping - Ping, but with a graph

gping 🚀 Ping, but with a graph. Table of Contents Install 💿 Usage 🎷 Install 💿 macOS Homebrew: brew install gping MacPorts: sudo port install gping

Fake ping times.

Pong A Linux program that replies to ping but modifies the payload of the ICMP package to get lower ping times in some ping implementations. See https

Proxies all incoming connections to a minecraft server of your choosing, while also logging all ping and login requests to a json file and discord webhook.

minecraft-honeypot Proxies all incoming connections to a minecraft server of your choosing, while also logging all ping and login requests to a json f

Core lightning (CLN) plugin to watch channel health, gossip health and ping amboss for online status

vitality Core lightning (CLN) plugin to watch channel health, gossip health and ping amboss for online status Installation Building Usage Telegram Opt

A multi-targets ping tool and library, which supports 10,000 packets/second, accurate latency

mping-rs a multi-targets ping tool, which supports 10,000 packets/second, accurate latency. 一个高频ping工具,支持多个目标。 正常的ping一般用来做探测工具,mping还可以用来做压测工具。 Go版本:

A simple ping utility written in Rust, that is focused on being size efficient and fast.
A simple ping utility written in Rust, that is focused on being size efficient and fast.

MeowPing MeowPing is a command-line utility for testing network connectivity using ICMP echo requests or TCP connections. It provides similar function

A toy ray tracer in Rust
A toy ray tracer in Rust

tray_rust - A Toy Ray Tracer in Rust tray_rust is a toy physically based ray tracer built off of the techniques discussed in Physically Based Renderin

sublingual: toy versions of existing programming languages

sublingual: toy versions of existing programming languages This is a collection of toy languages created by taking much "larger" languages (e.g. Rust)

Owner
Sherub Thakur
Programmer
Sherub Thakur
Core lightning (CLN) plugin to watch channel health, gossip health and ping amboss for online status

vitality Core lightning (CLN) plugin to watch channel health, gossip health and ping amboss for online status Installation Building Usage Telegram Opt

null 4 Oct 6, 2023
Turbine is a toy CLI app for converting Rails schema declarations into equivalent type declarations in other languages.

Turbine Turbine is a toy CLI app for converting Rails schema declarations into equivalent type declarations in other languages. It’s described as a to

Justin 2 Jan 21, 2022
a (soon to be) calculator frontend and a (soon to be optimizing) toy IR backend

Zach-Calc Zach-Calc is a pet project for me to try and better understand pattern matching, optimization, IRs, and the likes. ./libs/* contains librari

Zachary Petti 0 Jan 6, 2022
A toy example showing how to run Rust code in Python for speed and progress.

PoC: Integrating Rust in Python A toy example showing how to run Rust code in Python for speed and progress. Requirements Python 3.6+ Rust 1.44+ Cargo

Emil Thorenfeldt 2 Feb 7, 2022
Toy Shell Written in Rust

This is a simple toy shell written in Rust language with porpose of learning system programmim, and in a specific theme, process management.

Júlio César de Brito Gardona 4 May 22, 2022
For something between the likes of a toy bootloader or tiny kernel and Arch Linux.

For something between the likes of a toy bootloader or tiny kernel and Arch Linux.

Aarush Gupta 3 Oct 9, 2022
A toy event store and event messaging system.

RDeeBee Follow this blog series for more details on this project. This system is inspired by Martin Kleppman's arguments that Event Sourcing system an

null 4 Nov 6, 2022
A BASIC language interpreter. Does not conform to existing standards. Mostly a toy.

JW-Basic A toy language that is somewhat like QBasic. Features: Graphics: 160x96 (255 colors & transparent) Text: 32x16 (4x5 font) Character set: ASCI

John Wells 8 Feb 15, 2023
A cat(1) clone with syntax highlighting and Git integration.

A cat(1) clone with syntax highlighting and Git integration. Key Features • How To Use • Installation • Customization • Project goals, alternatives [中

David Peter 38.9k Jan 8, 2023
A fast, resilient, isomorphic hacker news clone in ~1k lines of rust.

Hackernews sauron A hacker news clone in ~1k lines of rust. This is using sauron web-framework. Feature Isomorphic Completely identical server-side re

Jovansonlee Cesar 102 Nov 19, 2022