Skip to content

Commit 32f1fcd

Browse files
feat: simple iroh (#2968)
## Description This is the nexst step to transforming the `iroh` crate, it now is purely a reexport crate of the fundamental building blocks - `iroh-base` - `iroh-net` - `iroh-router` ## Breaking Changes - removed - `iroh::node` - `iroh::metrics` - `iroh::util` - `load_secret_key` moved to `iroh_node_utils` to preserve it ## Notes & open questions ## Change checklist - [ ] Self-review. - [ ] 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. - [ ] All breaking changes documented.
1 parent c999770 commit 32f1fcd

File tree

19 files changed

+29
-2286
lines changed

19 files changed

+29
-2286
lines changed

Cargo.lock

Lines changed: 1 addition & 283 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

iroh-net/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@ iroh-relay = { version = "0.28", path = "../iroh-relay", features = ["test-utils
172172
name = "key"
173173
harness = false
174174

175-
[build-dependencies]
176-
duct = "0.13.6"
177-
178175
[features]
179176
default = ["metrics", "discovery-pkarr-dht"]
180177
metrics = ["iroh-metrics/metrics"]

iroh/src/util/fs.rs renamed to iroh-node-util/src/fs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//! Utilities for filesystem operations.
2+
23
use std::path::PathBuf;
34

45
use anyhow::Context;

iroh-node-util/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ pub mod config;
1212
pub mod logging;
1313
pub mod rpc;
1414

15+
pub mod fs;
16+
1517
use std::path::PathBuf;
1618

1719
use anyhow::Context;

iroh/Cargo.toml

Lines changed: 21 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -16,92 +16,44 @@ rust-version = "1.76"
1616
workspace = true
1717

1818
[dependencies]
19-
anyhow = { version = "1" }
20-
async-channel = "2.3.1"
21-
bytes = "1.7"
22-
derive_more = { version = "1.0.0", features = [
23-
"debug",
24-
"display",
25-
"from",
26-
"try_into",
27-
"from_str",
28-
] }
29-
futures-lite = "2.5"
30-
futures-util = "0.3"
3119
iroh-base = { version = "0.28.0", features = ["key"] }
32-
iroh-io = { version = "0.6.0", features = ["stats"] }
33-
iroh-metrics = { version = "0.28.0", optional = true }
34-
iroh-net = { version = "0.28.1", features = ["discovery-local-network"] }
35-
iroh-node-util = { version = "0.28.0", path = "../iroh-node-util" }
20+
iroh-net = { version = "0.28.1", default-features = false }
3621
iroh-router = { version = "0.28.0" }
37-
nested_enum_utils = "0.1.0"
38-
num_cpus = { version = "1.15.0" }
39-
parking_lot = "0.12.1"
40-
postcard = { version = "1", default-features = false, features = [
41-
"alloc",
42-
"use-std",
43-
"experimental-derive",
44-
] }
45-
quic-rpc = { version = "0.15", default-features = false, features = [
46-
"flume-transport",
47-
"quinn-transport",
48-
] }
49-
quic-rpc-derive = { version = "0.15" }
50-
quinn = { package = "iroh-quinn", version = "0.12" }
51-
serde = { version = "1", features = ["derive"] }
52-
strum = { version = "0.26", features = ["derive"] }
53-
thiserror = "2"
54-
tempfile = "3.4"
55-
tokio = { version = "1", features = ["io-util", "rt"] }
56-
tokio-util = { version = "0.7", features = ["codec", "io-util", "io", "time"] }
57-
tracing = "0.1"
58-
iroh-relay = { version = "0.28", path = "../iroh-relay" }
59-
ref-cast = "1.0.23"
6022

6123
# Examples
24+
anyhow = { version = "1", optional = true }
6225
clap = { version = "4", features = ["derive"], optional = true }
6326
indicatif = { version = "0.17", features = ["tokio"], optional = true }
6427
parse-size = { version = "=1.0.0", optional = true } # pinned version to avoid bumping msrv to 1.81
28+
tokio = { version = "1", features = ["full"], optional = true }
29+
tracing-subscriber = { version = "0.3", features = ["env-filter"], optional = true }
30+
futures-lite = { version = "2.5", optional = true }
31+
tracing = { version = "0.1", optional = true }
32+
bytes = { version = "1.8", optional = true }
6533

66-
# Documentation tests
67-
url = { version = "2.5", features = ["serde"] }
68-
serde-error = "0.1.3"
6934

7035
[features]
71-
default = ["metrics"]
72-
metrics = ["iroh-metrics"]
73-
test = []
36+
default = ["metrics", "discovery-pkarr-dht"]
37+
metrics = ["iroh-net/metrics"]
38+
discovery-local-network = ["iroh-net/discovery-local-network"]
7439
discovery-pkarr-dht = ["iroh-net/discovery-pkarr-dht"]
75-
test-utils = ["iroh-net/test-utils"]
7640

77-
examples = ["dep:clap", "dep:indicatif", "dep:parse-size"]
78-
79-
[dev-dependencies]
80-
anyhow = { version = "1" }
81-
bao-tree = { version = "0.13", features = ["tokio_fsm"] }
82-
futures-buffered = "0.2.4"
83-
genawaiter = { version = "0.99", features = ["futures03"] }
84-
iroh = { path = ".", features = ["test-utils"] }
85-
iroh-test = "0.28.0"
86-
proptest = "1.2.0"
87-
rand = "0.8"
88-
rand_chacha = "0.3.1"
89-
regex = { version = "1.7.1", features = ["std"] }
90-
serde_json = "1"
91-
testdir = "0.9.1"
92-
testresult = "0.4.0"
93-
tokio = { version = "1", features = ["macros", "io-util", "rt"] }
94-
tokio-stream = "0.1"
95-
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
41+
examples = [
42+
"dep:anyhow",
43+
"dep:clap",
44+
"dep:indicatif",
45+
"dep:parse-size",
46+
"dep:tokio",
47+
"dep:tracing-subscriber",
48+
"dep:futures-lite",
49+
"dep:tracing",
50+
"dep:bytes",
51+
]
9652

9753
[package.metadata.docs.rs]
9854
all-features = true
9955
rustdoc-args = ["--cfg", "iroh_docsrs"]
10056

101-
[[example]]
102-
name = "rpc"
103-
required-features = ["examples"]
104-
10557
[[example]]
10658
name = "transfer"
10759
required-features = ["examples"]

iroh/examples/rpc.rs

Lines changed: 0 additions & 73 deletions
This file was deleted.

iroh/examples/transfer.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ use clap::{Parser, Subcommand};
99
use futures_lite::StreamExt;
1010
use indicatif::HumanBytes;
1111
use iroh_net::{
12-
key::SecretKey, ticket::NodeTicket, Endpoint, NodeAddr, RelayMap, RelayMode, RelayUrl,
12+
endpoint::ConnectionError, key::SecretKey, ticket::NodeTicket, Endpoint, NodeAddr, RelayMap,
13+
RelayMode, RelayUrl,
1314
};
1415
use tracing::info;
1516

@@ -132,7 +133,7 @@ async fn provide(size: u64, relay_url: Option<String>) -> anyhow::Result<()> {
132133
// it received this message.
133134
let res = tokio::time::timeout(Duration::from_secs(3), async move {
134135
let closed = conn.closed().await;
135-
if !matches!(closed, quinn::ConnectionError::ApplicationClosed(_)) {
136+
if !matches!(closed, ConnectionError::ApplicationClosed(_)) {
136137
println!("node {node_id} disconnected with an error: {closed:#}");
137138
}
138139
})

iroh/src/client.rs

Lines changed: 0 additions & 59 deletions
This file was deleted.

iroh/src/client/quic.rs

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)