Crate kaboodle

Crate kaboodle 

Source
Expand description

Kaboodle is a Rust crate containing an approximate implementation of the SWIM membership gossip protocol, give or take some details. It can be used to discover other peers on the LAN without any central coordination.

use kaboodle::Kaboodle;
async fn example() {
    // UDP port number Kaboodle should use when discovering peers; every
    // Kaboodle instance must be using the same port number in order to find
    // each other.
    let port_number = 7475;
    // Which network interface to use; provide None to have Kaboodle select
    // one automatically.
    let preferred_interface = None;
    // Optional byte array used to durably identify this particular instance
    // of Kaboodle. Use this to give a particular machine a durable identity
    // if the application you are building on top of Kaboodle requires it.
    let identity = Some(b"instance1");

    let mut kaboodle = Kaboodle::new(7475, preferred_interface, identity).unwrap();
    kaboodle.start().await;
    let peers = kaboodle.peers().await;
    for (peer_address, peer_identity) in peers {
       // do something interesting
    }
}

Modules§

errors
Error types used internally to communicate details about errors specific to our implementation details.
networking
This utility module contains some network interface conveniences.
observable_hashmap

Structs§

Kaboodle
Data managed by a Kaboodle mesh client.