1 Commits
7 changed files with 88 additions and 91 deletions

No files matched your search

+3 -14
View File
@@ -1,22 +1,11 @@
# Changelog # Changelog
## [0.3.0] - 2026-04-07 ## [0.2.3] - 2026-04-06
### Changed ### Changed
- Upgraded to `donglora-client` 0.2: all connections now auto-validate via - README: clarify that the bridge relays raw LoRa packets and works with any
ping-on-connect, rejecting non-DongLoRa serial devices within 200ms. protocol (Meshtastic, MeshCore, etc.) simultaneously.
- Simplified connection logic — removed manual mux/serial fallback and manual
ping; `donglora_client::connect()` handles the full fallback chain and
validation internally.
- Config negotiation detects mux vs serial via transport type instead of
string comparison.
### Fixed
- Repository and homepage URLs now point to `github.com/donglora/bridge`
(was `swaits/donglora-bridge`).
- README links updated to `donglora` GitHub org.
## [0.2.2] - 2026-04-06 ## [0.2.2] - 2026-04-06
Generated
+3 -3
View File
@@ -906,7 +906,7 @@ dependencies = [
[[package]] [[package]]
name = "donglora-bridge" name = "donglora-bridge"
version = "0.3.0" version = "0.2.2"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"blake3", "blake3",
@@ -938,9 +938,9 @@ dependencies = [
[[package]] [[package]]
name = "donglora-client" name = "donglora-client"
version = "0.2.0" version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1936935d31ab56a8cd70ceecfd6d447f2628a73a123e1cfe37ee4987eab0fa70" checksum = "162468289ac189a798c4ecd961ed92c5dde2d9c5709d779ae324e0bb9a5ac4dc"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"serialport", "serialport",
+4 -4
View File
@@ -1,12 +1,12 @@
[package] [package]
name = "donglora-bridge" name = "donglora-bridge"
version = "0.3.0" version = "0.2.3"
edition = "2024" edition = "2024"
authors = ["Stephen Waits <steve@waits.net>"] authors = ["Stephen Waits <steve@waits.net>"]
license = "MIT" license = "MIT"
description = "Peer-to-peer LoRa bridge using iroh and DongLoRa" description = "Peer-to-peer LoRa bridge using iroh and DongLoRa"
repository = "https://github.com/donglora/bridge" repository = "https://github.com/swaits/donglora-bridge"
homepage = "https://github.com/donglora/bridge" homepage = "https://github.com/swaits/donglora-bridge"
keywords = ["lora", "bridge", "gossip", "p2p", "iot"] keywords = ["lora", "bridge", "gossip", "p2p", "iot"]
categories = ["network-programming", "command-line-utilities"] categories = ["network-programming", "command-line-utilities"]
readme = "README.md" readme = "README.md"
@@ -14,7 +14,7 @@ rust-version = "1.94.1"
exclude = [".jj/", ".github/"] exclude = [".jj/", ".github/"]
[dependencies] [dependencies]
donglora-client = "0.2" donglora-client = "0.1"
iroh = "0.97" iroh = "0.97"
iroh-gossip = "0.97" iroh-gossip = "0.97"
mainline = { version = "6", features = ["async"] } mainline = { version = "6", features = ["async"] }
+15 -12
View File
@@ -1,19 +1,22 @@
# donglora-bridge # donglora-bridge
[![CI](https://github.com/donglora/bridge/actions/workflows/ci.yml/badge.svg)](https://github.com/donglora/bridge/actions/workflows/ci.yml) [![CI](https://github.com/swaits/donglora-bridge/actions/workflows/ci.yml/badge.svg)](https://github.com/swaits/donglora-bridge/actions/workflows/ci.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
![Rust](https://img.shields.io/badge/rust-1.94.1%2B-orange) ![Rust](https://img.shields.io/badge/rust-1.94.1%2B-orange)
**donglora-bridge** connects LoRa radios to the internet so packets heard by one **donglora-bridge** relays raw LoRa packets over the internet. Every packet your
radio can be retransmitted by another radio anywhere in the world. radio hears is forwarded to every other bridge running the same passphrase, and
their radios retransmit it locally. Because it operates on raw packets, it works
with any protocol built on LoRa --
[Meshtastic](https://meshtastic.org/),
[MeshCore](https://github.com/rocketgithub/meshcore-firmware),
or anything else -- simultaneously and without configuration. If your radio can
hear it, the bridge will relay it.
[LoRa](https://en.wikipedia.org/wiki/LoRa) is a long-range, low-power wireless [LoRa](https://en.wikipedia.org/wiki/LoRa) is a long-range, low-power wireless
protocol used by off-grid mesh networks like modulation used by off-grid mesh networks. A single radio might cover a few
[MeshCore](https://github.com/rocketgithub/meshcore-firmware). A single LoRa kilometers. This bridge removes that limit, extending a local LoRa network
radio might cover a few kilometers. This bridge removes that limit: any packet across a larger geographic area.
your radio hears gets relayed over the internet to every other bridge running the
same passphrase, and their radios retransmit it locally. The result is a single
mesh network across a larger geographic area.
There is no central server. Bridges discover each other automatically using the There is no central server. Bridges discover each other automatically using the
[Mainline DHT](https://en.wikipedia.org/wiki/Mainline_DHT) and communicate [Mainline DHT](https://en.wikipedia.org/wiki/Mainline_DHT) and communicate
@@ -25,12 +28,12 @@ through an encrypted peer-to-peer gossip swarm.
### 1. A DongLoRa radio ### 1. A DongLoRa radio
[DongLoRa](https://github.com/donglora/firmware) is open-source firmware that [DongLoRa](https://github.com/swaits/donglora) is open-source firmware that
turns a supported LoRa development board (such as a Heltec WiFi LoRa 32 or turns a supported LoRa development board (such as a Heltec WiFi LoRa 32 or
similar ESP32+SX1262 board) into a USB LoRa dongle. You will need to: similar ESP32+SX1262 board) into a USB LoRa dongle. You will need to:
1. **Get a board** -- any ESP32 board with an SX1262 LoRa radio that DongLoRa 1. **Get a board** -- any ESP32 board with an SX1262 LoRa radio that DongLoRa
supports. See the [DongLoRa README](https://github.com/donglora/firmware) for supports. See the [DongLoRa README](https://github.com/swaits/donglora) for
the full list. the full list.
2. **Flash the DongLoRa firmware** onto the board. Instructions are in the 2. **Flash the DongLoRa firmware** onto the board. Instructions are in the
DongLoRa repository. DongLoRa repository.
@@ -68,7 +71,7 @@ mise use -g cargo:donglora-bridge
Or build from source: Or build from source:
```sh ```sh
git clone https://github.com/donglora/bridge.git git clone https://github.com/swaits/donglora-bridge.git
cd donglora-bridge cd donglora-bridge
cargo build --release cargo build --release
``` ```
+38 -47
View File
@@ -1,68 +1,59 @@
set shell := ["bash", "-c"] # Default: run all checks
default: build default: build
[private] # Run all checks (fmt, clippy, test)
_ensure_tools:
@mise trust --yes . 2>/dev/null; mise install --quiet
# Run the bridge (TUI mode)
run *args: _ensure_tools
cargo run --release -- {{args}}
# Run in headless mode
run-headless *args: _ensure_tools
cargo run --release -- --log-only {{args}}
# Run the config wizard
config: _ensure_tools
cargo run --release -- config
# Run all checks (fmt, clippy, test, audit)
check: fmt-check clippy test audit check: fmt-check clippy test audit
# Format code # Format code
fmt: _ensure_tools fmt:
cargo fmt cargo fmt
# Check formatting without changing files # Check formatting without changing files
fmt-check: _ensure_tools fmt-check:
cargo fmt --check cargo fmt --check
# Lint with clippy # Lint with clippy (pedantic + nursery)
clippy: _ensure_tools clippy:
cargo clippy --all-targets -- -D warnings cargo clippy --all-targets -- -D warnings
# Run all tests
test: test-unit
# Normal unit tests
test-unit: _ensure_tools
cargo nextest run
# Mutation testing
test-mutants *args: _ensure_tools
cargo mutants {{args}}
# Fuzz a target (requires nightly)
test-fuzz TARGET="fuzz_gossip_frame_decode" DURATION="60": _ensure_tools
cargo +nightly fuzz run {{TARGET}} -- -max_total_time={{DURATION}}
# Security + license audit
audit: _ensure_tools
cargo deny check
# Build release binary # Build release binary
build: _ensure_tools build:
cargo build --release cargo build --release
# Generate docs # Generate docs
doc: _ensure_tools doc:
cargo doc --no-deps --open cargo doc --no-deps --open
# Check for outdated dependencies # Run the bridge (TUI mode)
outdated: _ensure_tools run *ARGS:
cargo outdated cargo run --release -- {{ARGS}}
# Run in headless mode
run-headless *ARGS:
cargo run --release -- --log-only {{ARGS}}
# Run the config wizard
config:
cargo run --release -- config
# Security + license audit
audit:
cargo deny check
# Run all tests
test: test-unit test-fuzz test-mutants
# Normal unit tests
test-unit:
cargo nextest run
# Mutation testing
test-mutants *ARGS:
cargo mutants {{ARGS}}
# Fuzz a target (requires nightly)
test-fuzz TARGET="fuzz_gossip_frame_decode" DURATION="60":
cargo +nightly fuzz run {{TARGET}} -- -max_total_time={{DURATION}}
# Clean build artifacts # Clean build artifacts
clean: clean:
-3
View File
@@ -1,3 +0,0 @@
[tools]
rust = "1.94"
just = "latest"
+25 -8
View File
@@ -6,7 +6,7 @@
use std::time::Duration; use std::time::Duration;
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use donglora_client::{AnyTransport, RadioConfig, Response, Transport}; use donglora_client::{RadioConfig, Response, Transport};
use tokio::sync::mpsc; use tokio::sync::mpsc;
use tracing::{debug, error, info, warn}; use tracing::{debug, error, info, warn};
@@ -93,13 +93,30 @@ fn connect_and_run(
let timeout = Duration::from_secs(10); let timeout = Duration::from_secs(10);
info!("connecting to dongle..."); info!("connecting to dongle...");
let mut client = donglora_client::connect(port, timeout)?; let (mut client, device) = if let Some(port) = port {
let is_mux = matches!(client.transport(), AnyTransport::Mux(_)); let c = donglora_client::connect(Some(port), timeout)?;
let device = if is_mux { "mux".to_string() } else { port.map_or_else(|| "usb".to_string(), shorten_path) }; (c, shorten_path(port))
info!("[radio] connected and validated: {device}"); } else if let Ok(c) = donglora_client::connect_mux_auto(timeout) {
(c, "mux".to_string())
} else {
let port_path = donglora_client::find_port().ok_or_else(|| anyhow::anyhow!("no mux or USB dongle found"))?;
info!("no mux found, connecting to serial port {port_path}");
let c = donglora_client::connect(Some(&port_path), timeout)?;
(c, shorten_path(&port_path))
};
info!("[radio] transport connected: {device}");
info!("[radio] sending ping...");
match client.ping() {
Ok(()) => info!("[radio] ping OK"),
Err(e) => {
info!("[radio] ping FAILED: {e:#}");
return Err(e);
}
}
info!("[radio] negotiating config..."); info!("[radio] negotiating config...");
let (active_config, config_source) = match negotiate_config(&mut client, config, is_mux) { let (active_config, config_source) = match negotiate_config(&mut client, config, &device) {
Ok(result) => { Ok(result) => {
info!("[radio] config negotiated: source={:?}, config={}", result.1, format_radio_config(&result.0)); info!("[radio] config negotiated: source={:?}, config={}", result.1, format_radio_config(&result.0));
result result
@@ -198,7 +215,7 @@ fn connect_and_run(
fn negotiate_config<T: Transport>( fn negotiate_config<T: Transport>(
client: &mut donglora_client::Client<T>, client: &mut donglora_client::Client<T>,
desired: &RadioConfig, desired: &RadioConfig,
is_mux: bool, device: &str,
) -> Result<(RadioConfig, ConfigSource)> { ) -> Result<(RadioConfig, ConfigSource)> {
info!("[negotiate] get_config..."); info!("[negotiate] get_config...");
match client.get_config() { match client.get_config() {
@@ -206,7 +223,7 @@ fn negotiate_config<T: Transport>(
if configs_match(&cfg, desired) { if configs_match(&cfg, desired) {
info!("[negotiate] get_config OK (matches desired): {}", format_radio_config(&cfg)); info!("[negotiate] get_config OK (matches desired): {}", format_radio_config(&cfg));
Ok((cfg, ConfigSource::Ours)) Ok((cfg, ConfigSource::Ours))
} else if is_mux { } else if device == "mux" {
info!("[negotiate] get_config OK (mux config differs, accepting): {}", format_radio_config(&cfg)); info!("[negotiate] get_config OK (mux config differs, accepting): {}", format_radio_config(&cfg));
Ok((cfg, ConfigSource::Mux)) Ok((cfg, ConfigSource::Mux))
} else { } else {