truffle 0.4.8

P2P mesh networking for your devices, built on Tailscale
Documentation

truffle

P2P mesh networking for your devices, built on Tailscale.

This is the convenience crate that bundles truffle-core (the Rust library) and truffle-sidecar (auto-downloaded Go binary). For most users, this is the only dependency you need.

Quick start

[dependencies]
truffle = "0.4"
use truffle::{Node, sidecar_path};
use truffle::network::tailscale::TailscaleProvider;

# async fn example() -> Result<(), Box<dyn std::error::Error>> {
let node = Node::<TailscaleProvider>::builder()
    .app_id("my-app")?
    .device_name("my-device")
    .sidecar_path(sidecar_path())
    .build()
    .await?;

// Send a message to all peers
node.broadcast("chat", b"hello!").await;

// Subscribe to messages
let mut rx = node.subscribe("chat");
# Ok(())
# }

Advanced: BYO sidecar

If you want to manage the sidecar binary yourself, depend on truffle-core directly:

[dependencies]
truffle-core = "0.4"