#multicast #discovery #mdns #peers


Chart (discover) instances of your application on the same network and or machine

3 unstable releases

Uses new Rust 2021

0.2.1 Jun 3, 2022
0.2.0 May 12, 2022
0.1.0 Apr 26, 2022

#1985 in Network programming

MIT license

875 lines

Provides data about other instances on the same machine/network

This crate provides a lightweight alternative to mDNS. It discovers other instances on the same network or (optionally) machine. You provide an Id and some data you want to share. Usually this is a port your service uses. This gives you a live updating chart of all the discovered Ids-data pairs and the corrosponding ip adresses.

The chart can contain instances that are now down. It can not be used to check if a service is up.


Add a dependency on instance-chart in Cargo.toml:

instance_chart = "0.1"

Now add the following snippet somewhere in your codebase. Discovery will stop when you drop the maintain future.

use std::error::Error;
use instance_chart::{discovery, ChartBuilder};

async fn main() -> Result<(), Box<dyn Error>> {
   let chart = ChartBuilder::new()
   let maintain = discovery::maintain(chart.clone());
   let _ = tokio::spawn(maintain); // maintain task will run forever


~145K SLoC