peat-mesh
Mesh networking library with CRDT sync, transport security, and topology management.
Overview
peat-mesh provides the core mesh networking layer for the Peat protocol, including:
- Transport - Pluggable transports (UDP bypass, BLE) with connection health monitoring and reconnection
- Security - Ed25519 identity, X25519 key exchange, ChaCha20-Poly1305 encryption, formation keys
- Discovery - mDNS and static peer discovery with hybrid strategies
- Topology - Dynamic topology management with partition detection and autonomous operation
- Routing - Mesh routing with data aggregation and deduplication
- Storage - Automerge CRDT backend with Iroh P2P sync, negentropy set reconciliation, redb persistence, and streaming large-blob transfer
- Beacon - Geographic beacon broadcasting and observation with geohash indexing
- QoS - Bandwidth management, TTL, retention policies, sync modes, and garbage collection
- Broker - Optional HTTP/WebSocket service broker (Axum-based)
Installation
[]
= "0.3.2"
Feature flags
| Feature | Description |
|---|---|
automerge-backend |
Automerge CRDT storage with Iroh P2P sync and redb persistence |
bluetooth |
BLE mesh transport via peat-btle |
broker |
HTTP/WebSocket service broker (Axum) |
kubernetes |
Kubernetes peer discovery via EndpointSlice API (guide) |
node |
All-in-one feature for the peat-mesh-node binary (includes broker, kubernetes, automerge-backend) |
lite-bridge |
UDP bridge for Peat-Lite embedded devices (OTA, telemetry) |
# Example with features
= { = "0.1.0", = ["automerge-backend", "bluetooth"] }
Quick start
use ;
async
Streaming Transfer
peat-mesh includes a streaming large-blob transfer module for bounded-memory file transfer across DDIL links. Transfers use O(chunk_size) memory regardless of blob size, with incremental SHA256 verification and resumable sessions via periodic checkpointing.
use ;
// Pre-built profiles for different network conditions
let config = tactical; // 256 KiB chunks, 30s checkpoint interval
// Also available: StreamingTransferConfig::datacenter() and ::edge()
// Resume from a previous checkpoint
let checkpoint = load?;
| Profile | Chunk Size | Checkpoint Interval | Use Case |
|---|---|---|---|
datacenter() |
1 MiB | 60s | High-bandwidth, reliable links |
tactical() |
256 KiB | 30s | Intermittent tactical networks |
edge() |
64 KiB | 10s | Low-bandwidth edge/BTLE links |
Kubernetes Deployment
peat-mesh includes a binary target (peat-mesh-node), Dockerfile, and Helm chart for Kubernetes deployment.
# Build the binary
# Build Docker image
# Deploy to k3d (local Kubernetes)
See the full Deployment Guide for details on configuration, verification, cluster lifecycle, and multi-cluster federation testing.
Development
# Build (default features)
# Build with all optional features
# Run tests
# Clippy
CI
CI runs via GOA (GitOps Agent) on every Radicle patch:
- Format -
cargo fmt --check - Clippy -
cargo clippy -- -D warnings - Tests -
cargo test - Feature builds -
automerge-backend,bluetooth,broker
Results are posted as patch reviews (accept/reject). Community patches require a delegate "ok-to-test" comment before CI runs.
Manual CI
# Run the full CI pipeline locally
Source
License
Apache-2.0
OTA Firmware Updates
peat-mesh nodes can push firmware updates to Peat-Lite ESP32 devices over UDP:
# Via HTTP API (when running as peat-mesh-node)
# Check progress
The OTA sender implements stop-and-wait reliable transfer with SHA256 verification and optional Ed25519 signing. See ADR-047 for protocol details.