From fb20176763f5a59727ad3c553641c830bb847cfb Mon Sep 17 00:00:00 2001 From: Friedel Ziegelmayer Date: Thu, 28 Nov 2024 15:51:02 +0100 Subject: [PATCH] refactor: cleanup internal dependency references (#2976) ## Description - no more patching - always use local path deps for workspace dependencies - fix clippy complaints on rust `1.83` ## Breaking Changes None ## Notes & open questions ## Change checklist - [x] Self-review. - [x] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [ ] Tests if relevant. - [x] All breaking changes documented. --- Cargo.lock | 59 +++++++++++---------------------- Cargo.toml | 7 ---- iroh-base/src/relay_url.rs | 2 +- iroh-dns-server/Cargo.toml | 6 ++-- iroh-net-report/Cargo.toml | 6 ++-- iroh-node-util/Cargo.toml | 2 +- iroh-relay/Cargo.toml | 9 ++--- iroh-relay/src/protos/relay.rs | 28 ++++++++-------- iroh/Cargo.toml | 6 ++-- iroh/src/endpoint.rs | 2 +- net-tools/portmapper/Cargo.toml | 2 +- 11 files changed, 49 insertions(+), 80 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8d8987ee3f..46446f49da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -435,9 +435,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" +checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" [[package]] name = "cast" @@ -1110,18 +1110,6 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" -[[package]] -name = "duct" -version = "0.13.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ab5718d1224b63252cd0c6f74f6480f9ffeb117438a2e0f5cf6d9a4798929c" -dependencies = [ - "libc", - "once_cell", - "os_pipe", - "shared_child", -] - [[package]] name = "dyn-clone" version = "1.0.17" @@ -2437,7 +2425,7 @@ dependencies = [ "iroh-quinn-proto", "iroh-quinn-udp", "iroh-relay", - "iroh-test", + "iroh-test 0.28.0", "libc", "netdev", "netlink-packet-core", @@ -2505,7 +2493,7 @@ dependencies = [ "getrandom", "hex", "iroh-blake3", - "iroh-test", + "iroh-test 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)", "once_cell", "postcard", "proptest", @@ -2556,7 +2544,7 @@ dependencies = [ "http 1.1.0", "iroh", "iroh-metrics", - "iroh-test", + "iroh-test 0.28.0", "lru", "parking_lot", "pkarr", @@ -2635,7 +2623,7 @@ dependencies = [ "iroh-base", "iroh-metrics", "iroh-relay", - "iroh-test", + "iroh-test 0.28.0", "netwatch", "once_cell", "portmapper", @@ -2740,7 +2728,6 @@ dependencies = [ "clap", "crypto_box", "derive_more", - "duct", "futures-buffered", "futures-lite 2.5.0", "futures-sink", @@ -2756,7 +2743,7 @@ dependencies = [ "hyper-util", "iroh-base", "iroh-metrics", - "iroh-test", + "iroh-test 0.28.0", "libc", "num_enum", "once_cell", @@ -2804,6 +2791,18 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "iroh-test" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f909a839e5aafd4c4ca473e6e143bacdd6a8483385e64186cacfa62e91f4081d" +dependencies = [ + "anyhow", + "tokio", + "tracing", + "tracing-subscriber", +] + [[package]] name = "is-terminal" version = "0.4.13" @@ -3465,16 +3464,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "os_pipe" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ffd2b0a5634335b135d5728d84c5e0fd726954b87111f7506a61c502280d982" -dependencies = [ - "libc", - "windows-sys 0.59.0", -] - [[package]] name = "overload" version = "0.1.1" @@ -4891,16 +4880,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "shared_child" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fa9338aed9a1df411814a5b2252f7cd206c55ae9bf2fa763f8de84603aa60c" -dependencies = [ - "libc", - "windows-sys 0.59.0", -] - [[package]] name = "shlex" version = "1.3.0" diff --git a/Cargo.toml b/Cargo.toml index fd102bb875..9bea247a24 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,10 +45,3 @@ unexpected_cfgs = { level = "warn", check-cfg = ["cfg(iroh_docsrs)"] } [workspace.lints.clippy] unused-async = "warn" - -# Temporary fix for dependencies -[patch.crates-io] -iroh = { path = "./iroh" } -iroh-base = { path = "./iroh-base" } -iroh-metrics = { path = "./iroh-metrics" } -iroh-test = { path = "./iroh-test" } diff --git a/iroh-base/src/relay_url.rs b/iroh-base/src/relay_url.rs index fb828e8bf1..0199304064 100644 --- a/iroh-base/src/relay_url.rs +++ b/iroh-base/src/relay_url.rs @@ -84,7 +84,7 @@ impl fmt::Debug for RelayUrl { /// output. struct DbgStr<'a>(&'a str); -impl<'a> fmt::Debug for DbgStr<'a> { +impl fmt::Debug for DbgStr<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, r#""{}""#, self.0) } diff --git a/iroh-dns-server/Cargo.toml b/iroh-dns-server/Cargo.toml index 06ddbe29fe..c8771a8c2e 100644 --- a/iroh-dns-server/Cargo.toml +++ b/iroh-dns-server/Cargo.toml @@ -29,7 +29,7 @@ governor = "0.6.3" #needs new release of tower_governor for 0.7.0 hickory-proto = "=0.25.0-alpha.2" hickory-server = { version = "=0.25.0-alpha.2", features = ["dns-over-rustls"] } http = "1.0.0" -iroh-metrics = { version = "0.28.0" } +iroh-metrics = { version = "0.28.0", path = "../iroh-metrics" } lru = "0.12.3" parking_lot = "0.12.1" pkarr = { version = "2.2.0", features = [ "async", "relay", "dht"], default-features = false } @@ -60,8 +60,8 @@ z32 = "1.1.1" [dev-dependencies] hickory-resolver = "=0.25.0-alpha.2" -iroh = { version = "0.28.0" } -iroh-test = "0.28.0" +iroh = { version = "0.28.0", path = "../iroh" } +iroh-test = { version = "0.28.0", path = "../iroh-test" } pkarr = { version = "2.2.0", features = ["rand"] } [package.metadata.docs.rs] diff --git a/iroh-net-report/Cargo.toml b/iroh-net-report/Cargo.toml index d7367a8a97..0d8aaa4626 100644 --- a/iroh-net-report/Cargo.toml +++ b/iroh-net-report/Cargo.toml @@ -22,8 +22,8 @@ derive_more = { version = "1.0.0", features = ["display"] } futures-buffered = "0.2.8" futures-lite = "2.3" hickory-resolver = "=0.25.0-alpha.2" -iroh-base = { version = "0.28.0", default-features = false, features = ["relay"] } -iroh-metrics = { version = "0.28.0", default-features = false, optional = true } +iroh-base = { version = "0.28.0", path = "../iroh-base", default-features = false, features = ["relay"] } +iroh-metrics = { version = "0.28.0", path = "../iroh-metrics", default-features = false, optional = true } iroh-relay = { version = "0.28", path = "../iroh-relay" } netwatch = { version = "0.1.0", path = "../net-tools/netwatch" } portmapper = { version = "0.1.0", path = "../net-tools/portmapper" } @@ -39,7 +39,7 @@ url = { version = "2.4" } [dev-dependencies] iroh-relay = { version = "0.28", path = "../iroh-relay", features = ["test-utils", "server"] } -iroh-test = "0.28.0" +iroh-test = { version = "0.28.0", path = "../iroh-test" } once_cell = "1.18.0" pretty_assertions = "1.4" testresult = "0.4.0" diff --git a/iroh-node-util/Cargo.toml b/iroh-node-util/Cargo.toml index a3df0145cc..bb28e56bac 100644 --- a/iroh-node-util/Cargo.toml +++ b/iroh-node-util/Cargo.toml @@ -19,7 +19,7 @@ workspace = true anyhow = "1" clap = { version = "4", features = ["derive"], optional = true } tokio = "1" -iroh = { path = "../iroh" } +iroh = { version = "0.28.1", path = "../iroh" } tempfile = "3" strum = "0.26" nested_enum_utils = "0.1.0" diff --git a/iroh-relay/Cargo.toml b/iroh-relay/Cargo.toml index 967e406544..e2d7722c4c 100644 --- a/iroh-relay/Cargo.toml +++ b/iroh-relay/Cargo.toml @@ -38,8 +38,8 @@ http = "1" http-body-util = "0.1.0" hyper = { version = "1", features = ["server", "client", "http1"] } hyper-util = "0.1.1" -iroh-base = { version = "0.28.0", features = ["key"] } -iroh-metrics = { version = "0.28.0", default-features = false } +iroh-base = { version = "0.28.0", path = "../iroh-base", features = ["key"] } +iroh-metrics = { version = "0.28.0", path = "../iroh-metrics", default-features = false } libc = "0.2.139" num_enum = "0.7" once_cell = "1.18.0" @@ -110,12 +110,9 @@ tokio = { version = "1", features = [ "test-util", ] } tracing-subscriber = { version = "0.3", features = ["env-filter"] } -iroh-test = "0.28.0" +iroh-test = { version = "0.28.0", path = "../iroh-test" } serde_json = "1" -[build-dependencies] -duct = "0.13.6" - [features] default = ["metrics", "server"] server = [ diff --git a/iroh-relay/src/protos/relay.rs b/iroh-relay/src/protos/relay.rs index 4997dc2102..19edfcad65 100644 --- a/iroh-relay/src/protos/relay.rs +++ b/iroh-relay/src/protos/relay.rs @@ -1,4 +1,16 @@ //! This module implements the relaying protocol used the [`crate::server`] and [`crate::client`]. +//! +//! Protocol flow: +//! +//! Login: +//! * client connects +//! * -> client sends `FrameType::ClientInfo` +//! +//! Steady state: +//! * server occasionally sends `FrameType::KeepAlive` (or `FrameType::Ping`) +//! * client responds to any `FrameType::Ping` with a `FrameType::Pong` +//! * clients sends `FrameType::SendPacket` +//! * server then sends `FrameType::RecvPacket` to recipient use std::time::Duration; @@ -51,21 +63,9 @@ pub(crate) const PER_CLIENT_READ_QUEUE_DEPTH: usize = 512; /// with nodes running earlier protocol versions. pub(crate) const PROTOCOL_VERSION: usize = 3; -/// -/// Protocol flow: -/// -/// Login: -/// * client connects -/// * -> client sends FrameType::ClientInfo -/// -/// Steady state: -/// * server occasionally sends FrameType::KeepAlive (or FrameType::Ping) -/// * client responds to any FrameType::Ping with a FrameType::Pong -/// * clients sends FrameType::SendPacket -/// * server then sends FrameType::RecvPacket to recipient - +/// Indicates this IS the client's home node const PREFERRED: u8 = 1u8; -/// indicates this is NOT the client's home node +/// Indicates this IS NOT the client's home node const NOT_PREFERRED: u8 = 0u8; /// The one byte frame type at the beginning of the frame diff --git a/iroh/Cargo.toml b/iroh/Cargo.toml index a104b68fb2..0a01299362 100644 --- a/iroh/Cargo.toml +++ b/iroh/Cargo.toml @@ -44,7 +44,7 @@ http-body-util = "0.1.0" hyper = { version = "1", features = ["server", "client", "http1"] } hyper-util = "0.1.1" igd-next = { version = "0.15.1", features = ["aio_tokio"] } -iroh-base = { version = "0.28.0", features = ["key"] } +iroh-base = { version = "0.28.0", features = ["key"], path = "../iroh-base" } iroh-relay = { version = "0.28", path = "../iroh-relay" } libc = "0.2.139" netdev = "0.31.0" @@ -110,7 +110,7 @@ z32 = "1.0.3" net-report = { package = "iroh-net-report", path = "../iroh-net-report", version = "0.28" } # metrics -iroh-metrics = { version = "0.28.0", default-features = false } +iroh-metrics = { version = "0.28.0", path = "../iroh-metrics", default-features = false } strum = { version = "0.26", features = ["derive"] } # local-swarm-discovery @@ -166,7 +166,7 @@ tokio = { version = "1", features = [ "test-util", ] } tracing-subscriber = { version = "0.3", features = ["env-filter"] } -iroh-test = "0.28.0" +iroh-test = { version = "0.28.0", path = "../iroh-test" } serde_json = "1" testresult = "0.4.0" iroh-relay = { version = "0.28", path = "../iroh-relay", features = ["test-utils", "server"] } diff --git a/iroh/src/endpoint.rs b/iroh/src/endpoint.rs index 7764d01e1b..60d575f76c 100644 --- a/iroh/src/endpoint.rs +++ b/iroh/src/endpoint.rs @@ -1070,7 +1070,7 @@ pub struct Accept<'a> { ep: Endpoint, } -impl<'a> Future for Accept<'a> { +impl Future for Accept<'_> { type Output = Option; fn poll(self: Pin<&mut Self>, cx: &mut std::task::Context<'_>) -> Poll { diff --git a/net-tools/portmapper/Cargo.toml b/net-tools/portmapper/Cargo.toml index dbaa8e99df..c3ad942a75 100644 --- a/net-tools/portmapper/Cargo.toml +++ b/net-tools/portmapper/Cargo.toml @@ -20,7 +20,7 @@ derive_more = { version = "1.0.0", features = ["debug", "display", "from", "try_ futures-lite = "2.5" futures-util = "0.3.25" igd-next = { version = "0.15.1", features = ["aio_tokio"] } -iroh-metrics = { version = "0.28.0", default-features = false } +iroh-metrics = { version = "0.28.0", path = "../../iroh-metrics", default-features = false } libc = "0.2.139" netwatch = { version = "0.1.0", path = "../netwatch" } num_enum = "0.7"