From 222802cf133ff572da6d37f8f95dc721e3b9468c Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Tue, 7 Apr 2026 15:55:50 -0600 Subject: [PATCH] feat: upgrade to donglora-client 0.2, simplify connection, fix org URLs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Upgrade donglora-client from 0.1 to 0.2 (ping-on-connect validation) - Remove manual mux/serial fallback and manual ping — handled by client now - Fix repository/homepage URLs to github.com/donglora/bridge - Fix README links to donglora GitHub org --- CHANGELOG.md | 18 ++++++++++++++++++ Cargo.lock | 6 +++--- Cargo.toml | 8 ++++---- README.md | 8 ++++---- src/radio.rs | 33 ++++++++------------------------- 5 files changed, 37 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e20cb41..2ad27e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## [0.3.0] - 2026-04-07 + +### Changed + +- Upgraded to `donglora-client` 0.2: all connections now auto-validate via + ping-on-connect, rejecting non-DongLoRa serial devices within 200ms. +- 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 ### Fixed diff --git a/Cargo.lock b/Cargo.lock index ae001a9..a1a7438 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -906,7 +906,7 @@ dependencies = [ [[package]] name = "donglora-bridge" -version = "0.2.2" +version = "0.3.0" dependencies = [ "anyhow", "blake3", @@ -938,9 +938,9 @@ dependencies = [ [[package]] name = "donglora-client" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162468289ac189a798c4ecd961ed92c5dde2d9c5709d779ae324e0bb9a5ac4dc" +checksum = "1936935d31ab56a8cd70ceecfd6d447f2628a73a123e1cfe37ee4987eab0fa70" dependencies = [ "anyhow", "serialport", diff --git a/Cargo.toml b/Cargo.toml index 6875c82..eb204df 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "donglora-bridge" -version = "0.2.2" +version = "0.3.0" edition = "2024" authors = ["Stephen Waits "] license = "MIT" description = "Peer-to-peer LoRa bridge using iroh and DongLoRa" -repository = "https://github.com/swaits/donglora-bridge" -homepage = "https://github.com/swaits/donglora-bridge" +repository = "https://github.com/donglora/bridge" +homepage = "https://github.com/donglora/bridge" keywords = ["lora", "bridge", "gossip", "p2p", "iot"] categories = ["network-programming", "command-line-utilities"] readme = "README.md" @@ -14,7 +14,7 @@ rust-version = "1.94.1" exclude = [".jj/", ".github/"] [dependencies] -donglora-client = "0.1" +donglora-client = "0.2" iroh = "0.97" iroh-gossip = "0.97" mainline = { version = "6", features = ["async"] } diff --git a/README.md b/README.md index c61115e..00edd91 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # donglora-bridge -[![CI](https://github.com/swaits/donglora-bridge/actions/workflows/ci.yml/badge.svg)](https://github.com/swaits/donglora-bridge/actions/workflows/ci.yml) +[![CI](https://github.com/donglora/bridge/actions/workflows/ci.yml/badge.svg)](https://github.com/donglora/bridge/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) ![Rust](https://img.shields.io/badge/rust-1.94.1%2B-orange) @@ -25,12 +25,12 @@ through an encrypted peer-to-peer gossip swarm. ### 1. A DongLoRa radio -[DongLoRa](https://github.com/swaits/donglora) is open-source firmware that +[DongLoRa](https://github.com/donglora/firmware) is open-source firmware that 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: 1. **Get a board** -- any ESP32 board with an SX1262 LoRa radio that DongLoRa - supports. See the [DongLoRa README](https://github.com/swaits/donglora) for + supports. See the [DongLoRa README](https://github.com/donglora/firmware) for the full list. 2. **Flash the DongLoRa firmware** onto the board. Instructions are in the DongLoRa repository. @@ -68,7 +68,7 @@ mise use -g cargo:donglora-bridge Or build from source: ```sh -git clone https://github.com/swaits/donglora-bridge.git +git clone https://github.com/donglora/bridge.git cd donglora-bridge cargo build --release ``` diff --git a/src/radio.rs b/src/radio.rs index 2a311a3..0bf8b4c 100644 --- a/src/radio.rs +++ b/src/radio.rs @@ -6,7 +6,7 @@ use std::time::Duration; use anyhow::{Context, Result}; -use donglora_client::{RadioConfig, Response, Transport}; +use donglora_client::{AnyTransport, RadioConfig, Response, Transport}; use tokio::sync::mpsc; use tracing::{debug, error, info, warn}; @@ -93,30 +93,13 @@ fn connect_and_run( let timeout = Duration::from_secs(10); info!("connecting to dongle..."); - let (mut client, device) = if let Some(port) = port { - let c = donglora_client::connect(Some(port), timeout)?; - (c, shorten_path(port)) - } 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); - } - } + let mut client = donglora_client::connect(port, timeout)?; + let is_mux = matches!(client.transport(), AnyTransport::Mux(_)); + let device = if is_mux { "mux".to_string() } else { port.map_or_else(|| "usb".to_string(), shorten_path) }; + info!("[radio] connected and validated: {device}"); info!("[radio] negotiating config..."); - let (active_config, config_source) = match negotiate_config(&mut client, config, &device) { + let (active_config, config_source) = match negotiate_config(&mut client, config, is_mux) { Ok(result) => { info!("[radio] config negotiated: source={:?}, config={}", result.1, format_radio_config(&result.0)); result @@ -215,7 +198,7 @@ fn connect_and_run( fn negotiate_config( client: &mut donglora_client::Client, desired: &RadioConfig, - device: &str, + is_mux: bool, ) -> Result<(RadioConfig, ConfigSource)> { info!("[negotiate] get_config..."); match client.get_config() { @@ -223,7 +206,7 @@ fn negotiate_config( if configs_match(&cfg, desired) { info!("[negotiate] get_config OK (matches desired): {}", format_radio_config(&cfg)); Ok((cfg, ConfigSource::Ours)) - } else if device == "mux" { + } else if is_mux { info!("[negotiate] get_config OK (mux config differs, accepting): {}", format_radio_config(&cfg)); Ok((cfg, ConfigSource::Mux)) } else {