From b39977702408e8ed7ea547e2ad283d684c0a6698 Mon Sep 17 00:00:00 2001 From: Seb Kuzminsky Date: Mon, 1 Dec 2025 14:58:54 -0700 Subject: [PATCH 1/5] cargo: use my fork of Reticulum, for multicast UDP --- Cargo.lock | 32 ++++++++++++++++++++++++++++++-- Cargo.toml | 6 +++++- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b81dd58..c007ba2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -227,6 +227,12 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + [[package]] name = "cipher" version = "0.4.4" @@ -768,6 +774,15 @@ version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + [[package]] name = "mime" version = "0.3.17" @@ -791,6 +806,19 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084" +[[package]] +name = "nix" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74523f3a35e05aba87a1d978330aef40f67b0304ac79c1c00b294c9830543db6" +dependencies = [ + "bitflags", + "cfg-if", + "cfg_aliases", + "libc", + "memoffset", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -1035,8 +1063,7 @@ checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "reticulum" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d838809ab28f9bfa5354b3397bcfc2b4a7a7258e98d9ed2b18a6e39437b00202" +source = "git+http://github.com/SebKuzminsky/Reticulum-rs?branch=multicast#4db323aebd2cb4d11c24f7270b5cfd46a7b483d6" dependencies = [ "aes", "cbc", @@ -1046,6 +1073,7 @@ dependencies = [ "hkdf", "hmac", "log", + "nix", "prost", "rand_core", "rmp", diff --git a/Cargo.toml b/Cargo.toml index 0c20451..017c27b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,11 @@ tokio-util = "0.7.15" # Logging log = "0.4.27" env_logger = "0.10" -reticulum = "0.1.0" + +reticulum = { git="http://github.com/SebKuzminsky/Reticulum-rs", branch="multicast" } +#reticulum = { path = "../Reticulum-rs" } +#reticulum = { version="0.1.0" } + clap = { version = "4.5.53", features = ["derive"] } serde = { version = "1.0.228", features = ["derive"] } bincode = { version = "2.0.1", features = ["serde"] } From 229797ce1b28e8aa58d108fc5698e52556d1dc0b Mon Sep 17 00:00:00 2001 From: Seb Kuzminsky Date: Mon, 1 Dec 2025 21:14:30 -0700 Subject: [PATCH 2/5] udp config files for testing --- udp-other.toml | 5 +++++ udp.toml | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 udp-other.toml create mode 100644 udp.toml diff --git a/udp-other.toml b/udp-other.toml new file mode 100644 index 0000000..e3f5d11 --- /dev/null +++ b/udp-other.toml @@ -0,0 +1,5 @@ +[[interfaces]] +TcpServer = { bind_addr="0.0.0.0:4243" } + +[[interfaces]] +Udp = { bind_addr="0.0.0.0:4242", forward_addr="239.0.0.69:4242" } diff --git a/udp.toml b/udp.toml new file mode 100644 index 0000000..057b01c --- /dev/null +++ b/udp.toml @@ -0,0 +1,5 @@ +[[interfaces]] +TcpServer = { bind_addr="0.0.0.0:4242" } + +[[interfaces]] +Udp = { bind_addr="0.0.0.0:4242", forward_addr="239.0.0.69:4242" } From 7c53ed5ae77b85007f8b88386f9013f838e2096e Mon Sep 17 00:00:00 2001 From: sigil-03 Date: Tue, 2 Dec 2025 08:17:18 -0700 Subject: [PATCH 3/5] add periodic heartbeat broadcast --- src/main.rs | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 2351819..cdd54c7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,6 @@ +use rand_core::OsRng; +use reticulum::destination::DestinationName; +use reticulum::identity::PrivateIdentity; use tokio::fs; use clap::Parser; @@ -8,6 +11,7 @@ use reticulum::iface::tcp_client::TcpClient; use reticulum::iface::tcp_server::TcpServer; use reticulum::iface::udp::UdpInterface; use reticulum::transport::{Transport, TransportConfig}; +use tokio::time::{Duration, interval}; #[derive(Serialize, Deserialize, Debug, Clone)] struct TcpServerConfig { @@ -60,7 +64,15 @@ async fn main() { transport_config.set_retransmit(false); transport_config.set_broadcast(true); // set up the reticulum transport - let transport = Transport::new(transport_config); + let mut transport = Transport::new(transport_config); + + // set up destination + let id = PrivateIdentity::new_from_rand(OsRng); + + let hb_destination = transport + .add_destination(id, DestinationName::new("transport node", "heartbeat")) + .await; + log::info!("dest ID: {}", hb_destination.lock().await.desc.address_hash); // set up interfaces for iface_config in config.interfaces { @@ -87,8 +99,19 @@ async fn main() { } } - // run until exit - let _ = tokio::signal::ctrl_c().await; + let mut heartbeat_interval = interval(Duration::from_secs(5)); - log::info!("exit"); + loop { + tokio::select! { + _ = tokio::signal::ctrl_c() => { + break; + } + _ = heartbeat_interval.tick() => { + log::trace!("send heartbeat"); + transport.send_announce(&hb_destination, None).await; + } + } + } + + log::info!("exit!"); } From 184314975acbbad8cea0ae86ee71255a95b8a1f4 Mon Sep 17 00:00:00 2001 From: sigil-03 Date: Tue, 2 Dec 2025 15:18:43 -0700 Subject: [PATCH 4/5] add retransmit and broadcast to config file --- src/main.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index cdd54c7..5f3b12c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,6 +39,8 @@ enum InterfaceConfig { #[derive(Serialize, Deserialize, Debug, Clone)] struct Config { interfaces: Vec, + broadcast: bool, + retransmit: bool, } #[derive(Parser)] @@ -49,7 +51,7 @@ struct Cli { #[tokio::main] async fn main() { - env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("trace")).init(); + env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init(); log::info!(">>> TRANSPORT NODE <<<"); @@ -61,8 +63,8 @@ async fn main() { println!("{config:?}"); let mut transport_config = TransportConfig::default(); - transport_config.set_retransmit(false); - transport_config.set_broadcast(true); + transport_config.set_retransmit(config.retransmit); + transport_config.set_broadcast(config.broadcast); // set up the reticulum transport let mut transport = Transport::new(transport_config); From 119fd14f506c3f0a587ec6aca6a9c42341415baf Mon Sep 17 00:00:00 2001 From: sigil-03 Date: Tue, 2 Dec 2025 15:19:06 -0700 Subject: [PATCH 5/5] bump reticulum to upstream ref --- Cargo.lock | 3 +-- Cargo.toml | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b81dd58..e78264b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1035,8 +1035,7 @@ checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "reticulum" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d838809ab28f9bfa5354b3397bcfc2b4a7a7258e98d9ed2b18a6e39437b00202" +source = "git+https://github.com/BeechatNetworkSystemsLtd/Reticulum-rs.git#5012cf2c48044034775207ab7ee2c67d285276bb" dependencies = [ "aes", "cbc", diff --git a/Cargo.toml b/Cargo.toml index 0c20451..96bcd29 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,8 @@ tokio-util = "0.7.15" # Logging log = "0.4.27" env_logger = "0.10" -reticulum = "0.1.0" +reticulum = { git = "https://github.com/BeechatNetworkSystemsLtd/Reticulum-rs.git" } +# reticulum = "0.1.0" clap = { version = "4.5.53", features = ["derive"] } serde = { version = "1.0.228", features = ["derive"] } bincode = { version = "2.0.1", features = ["serde"] }