diff --git a/Cargo.lock b/Cargo.lock index ad063b26a0..60c362d8a1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -888,7 +888,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" dependencies = [ "clap_builder", - "clap_derive", ] [[package]] @@ -897,22 +896,8 @@ version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" dependencies = [ - "anstream", "anstyle", "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 2.0.90", ] [[package]] @@ -1099,6 +1084,15 @@ dependencies = [ "itertools", ] +[[package]] +name = "crossbeam-channel" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-deque" version = "0.8.5" @@ -2573,9 +2567,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hickory-proto" -version = "0.25.0-alpha.2" +version = "0.25.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8270a1857fb962b9914aafd46a89a187a4e63d0eb4190c327e7c7b8256a2d055" +checksum = "d063c0692ee669aa6d261988aa19ca5510f1cc40e4f211024f50c888499a35d7" dependencies = [ "async-recursion", "async-trait", @@ -2585,12 +2579,11 @@ dependencies = [ "futures-channel", "futures-io", "futures-util", - "idna 0.5.0", + "idna", "ipnet", "once_cell", "rand 0.8.5", - "thiserror 1.0.69", - "time 0.3.37", + "thiserror 2.0.6", "tinyvec", "tokio", "tracing", @@ -2599,21 +2592,21 @@ dependencies = [ [[package]] name = "hickory-resolver" -version = "0.25.0-alpha.2" +version = "0.25.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c110355b5703070d9e29c344d79818a7cde3de9c27fc35750defea6074b0ad" +checksum = "42bc352e4412fb657e795f79b4efcf2bd60b59ee5ca0187f3554194cd1107a27" dependencies = [ "cfg-if", "futures-util", "hickory-proto", "ipconfig", - "lru-cache", + "moka", "once_cell", "parking_lot", "rand 0.8.5", "resolv-conf", "smallvec", - "thiserror 1.0.69", + "thiserror 2.0.6", "tokio", "tracing", ] @@ -2989,16 +2982,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "1.0.3" @@ -3126,13 +3109,13 @@ checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "iroh" version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80b15215aea8d0367fefb9264521e4a251dc4e113896a3d765f530378518188f" +source = "git+https://github.com/n0-computer/iroh?branch=main#cf0f8cc4f7d842a41aed0a22cb5687315ca8f967" dependencies = [ "anyhow", "backoff", "base64 0.22.1", "bytes", + "concurrent-queue", "der", "derive_more", "futures-buffered", @@ -3142,7 +3125,6 @@ dependencies = [ "futures-util", "governor", "hex", - "hickory-proto", "hickory-resolver", "hostname 0.4.0", "http 1.2.0", @@ -3190,7 +3172,7 @@ dependencies = [ "tokio", "tokio-rustls", "tokio-stream", - "tokio-tungstenite 0.24.0", + "tokio-tungstenite 0.21.0", "tokio-tungstenite-wasm", "tokio-util", "tracing", @@ -3206,8 +3188,7 @@ dependencies = [ [[package]] name = "iroh-base" version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fd98293ce8e85e6b4f0ce09af7c6bb860f2fece8fcf9238d6e628f1e163e27a" +source = "git+https://github.com/n0-computer/iroh?branch=main#cf0f8cc4f7d842a41aed0a22cb5687315ca8f967" dependencies = [ "aead", "anyhow", @@ -3246,8 +3227,6 @@ dependencies = [ [[package]] name = "iroh-gossip" version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5688dded24660d9d64ab444768b969f8d4c06aae5221d9e2ef619f12873acee" dependencies = [ "anyhow", "async-channel 2.3.1", @@ -3296,8 +3275,7 @@ dependencies = [ [[package]] name = "iroh-net-report" version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b82dc449d537176fc90749ae0711c6f81479053086928a2f2bb87cb52646ba74" +source = "git+https://github.com/n0-computer/iroh?branch=main#cf0f8cc4f7d842a41aed0a22cb5687315ca8f967" dependencies = [ "anyhow", "bytes", @@ -3307,6 +3285,7 @@ dependencies = [ "hickory-resolver", "iroh-base", "iroh-metrics", + "iroh-quinn", "iroh-relay", "netwatch", "portmapper", @@ -3373,13 +3352,11 @@ dependencies = [ [[package]] name = "iroh-relay" version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28a0d0d7317795a01caa47ffdaeec84211d1b394530bdb31dbe15f642e58bcff" +source = "git+https://github.com/n0-computer/iroh?branch=main#cf0f8cc4f7d842a41aed0a22cb5687315ca8f967" dependencies = [ "anyhow", "base64 0.22.1", "bytes", - "clap", "derive_more", "futures-buffered", "futures-lite 2.5.0", @@ -3405,12 +3382,9 @@ dependencies = [ "pin-project", "postcard", "rand 0.8.5", - "rcgen", - "regex", "reqwest", "ring", "rustls", - "rustls-pemfile", "rustls-webpki", "serde", "smallvec", @@ -3420,13 +3394,10 @@ dependencies = [ "time 0.3.37", "tokio", "tokio-rustls", - "tokio-rustls-acme", - "tokio-tungstenite 0.24.0", + "tokio-tungstenite 0.21.0", "tokio-tungstenite-wasm", "tokio-util", - "toml", "tracing", - "tracing-subscriber", "url", "webpki-roots", ] @@ -3658,15 +3629,6 @@ version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" -[[package]] -name = "lru-cache" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" -dependencies = [ - "linked-hash-map", -] - [[package]] name = "lru_time_cache" version = "0.11.11" @@ -3760,6 +3722,26 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "moka" +version = "0.12.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32cf62eb4dd975d2dde76432fb1075c49e3ee2331cf36f1f8fd4b66550d32b6f" +dependencies = [ + "crossbeam-channel", + "crossbeam-epoch", + "crossbeam-utils", + "once_cell", + "parking_lot", + "quanta", + "rustc_version", + "smallvec", + "tagptr", + "thiserror 1.0.69", + "triomphe", + "uuid", +] + [[package]] name = "mutate_once" version = "0.1.1" @@ -6257,6 +6239,12 @@ version = "4.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "094c9f64d6de9a8506b1e49b63a29333b37ed9e821ee04be694d431b3264c3c5" +[[package]] +name = "tagptr" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" + [[package]] name = "tempfile" version = "3.14.0" @@ -6478,34 +6466,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-rustls-acme" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3184e8e292a828dd4bca5b2a60aba830ec5ed873a66c9ebb6e65038fa649e827" -dependencies = [ - "async-trait", - "base64 0.22.1", - "chrono", - "futures", - "log", - "num-bigint", - "pem", - "proc-macro2", - "rcgen", - "reqwest", - "ring", - "rustls", - "serde", - "serde_json", - "thiserror 2.0.6", - "time 0.3.37", - "tokio", - "tokio-rustls", - "webpki-roots", - "x509-parser", -] - [[package]] name = "tokio-stream" version = "0.1.17" @@ -6731,6 +6691,12 @@ dependencies = [ "tracing-log", ] +[[package]] +name = "triomphe" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3" + [[package]] name = "try-lock" version = "0.2.5" @@ -6843,12 +6809,6 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" -[[package]] -name = "unicode-bidi" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" - [[package]] name = "unicode-ident" version = "1.0.14" @@ -6926,7 +6886,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", - "idna 1.0.3", + "idna", "percent-encoding", "serde", ] diff --git a/Cargo.toml b/Cargo.toml index c421e6e621..dbce9088b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,15 +57,17 @@ fd-lock = "4" futures-lite = { workspace = true } futures = { workspace = true } hex = "0.4.0" -hickory-resolver = "=0.25.0-alpha.2" +hickory-resolver = "=0.25.0-alpha.4" http-body-util = "0.1.2" humansize = "2" hyper = "1" hyper-util = "0.1.10" image = { version = "0.25.5", default-features=false, features = ["gif", "jpeg", "ico", "png", "pnm", "webp", "bmp"] } -iroh-gossip = { version = "0.29", default-features = false, features = ["net"] } -iroh = { version = "0.29", default-features = false } -iroh-base = { version = "0.29", features = ["base32"] } +iroh-gossip = { path = "../iroh-gossip", default-features = false, features = ["net"] } +# iroh = { version = "0.29", default-features = false } +# iroh-base = { version = "0.29", features = ["base32"] } +iroh = { git = "https://github.com/n0-computer/iroh", branch = "main", default-features = false } +iroh-base = { git = "https://github.com/n0-computer/iroh", branch = "main", features = ["base32"] } kamadak-exif = "0.6.1" lettre_email = { git = "https://github.com/deltachat/lettre", branch = "master" } libc = { workspace = true } @@ -205,3 +207,10 @@ vendored = [ [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)'] } + +# [patch.crates-io] +# iroh-net-report = { path = "../iroh/iroh-net-report" } + +[patch.crates-io] +iroh-base = { git = "https://github.com/n0-computer/iroh", branch = "main" } +iroh = { git = "https://github.com/n0-computer/iroh", branch = "main" } diff --git a/src/peer_channels.rs b/src/peer_channels.rs index 4b56fefb62..4a985048bb 100644 --- a/src/peer_channels.rs +++ b/src/peer_channels.rs @@ -33,7 +33,6 @@ use iroh_gossip::proto::TopicId; use parking_lot::Mutex; use std::collections::{BTreeSet, HashMap}; use std::env; -use std::sync::Arc; use tokio::sync::{oneshot, RwLock}; use tokio::task::JoinHandle; use url::Url; @@ -57,7 +56,7 @@ pub struct Iroh { pub(crate) router: iroh::protocol::Router, /// [Gossip] needed for iroh peer channels. - pub(crate) gossip: Arc, + pub(crate) gossip: Gossip, /// Sequence numbers for gossip channels. pub(crate) sequence_numbers: Mutex>, @@ -125,7 +124,7 @@ impl Iroh { let (gossip_sender, gossip_receiver) = self .gossip - .join_with_opts(topic, JoinOptions::with_bootstrap(node_ids)) + .subscribe_with_opts(topic, JoinOptions::with_bootstrap(node_ids)) .split(); let ctx = ctx.clone(); @@ -147,7 +146,7 @@ impl Iroh { self.router.endpoint().add_node_addr(peer.clone())?; } - self.gossip.join_with_opts( + self.gossip.subscribe_with_opts( topic, JoinOptions::with_bootstrap(peers.into_iter().map(|peer| peer.node_id)), ); @@ -264,18 +263,15 @@ impl Context { // create gossip let my_addr = endpoint.node_addr().await?; - let gossip_config = iroh_gossip::proto::topic::Config { - // Allow messages up to 128 KB in size. - // We set the limit to 128 KiB to account for internal overhead, - // but only guarantee 128 KB of payload to WebXDC developers. - max_message_size: 128 * 1024, - ..Default::default() - }; - let gossip = Arc::new(Gossip::from_endpoint( - endpoint.clone(), - gossip_config, - &my_addr.info, - )); + let gossip = Gossip::builder() + .max_message_size( + // Allow messages up to 128 KB in size. + // We set the limit to 128 KiB to account for internal overhead, + // but only guarantee 128 KB of payload to WebXDC developers. + 128 * 1024, + ) + .spawn(endpoint.clone()) + .await?; let router = iroh::protocol::Router::builder(endpoint) .accept(GOSSIP_ALPN, gossip.clone())