Skip to content

Commit 24a1172

Browse files
committed
Merge branch 'main' into pluggable-gc-with-exemptions
# Conflicts: # src/net_protocol.rs
2 parents 715d668 + b9dbf2c commit 24a1172

21 files changed

+359
-417
lines changed

Cargo.lock

+307-357
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+8-7
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ indicatif = { version = "0.17.8", optional = true }
4141
iroh-base = { version = "0.28.0", features = ["redb"] }
4242
iroh-io = { version = "0.6.0", features = ["stats"] }
4343
iroh-metrics = { version = "0.28.0", default-features = false }
44-
iroh-net = { version = "0.28.1" }
45-
iroh-router = "0.28.0"
44+
iroh = { version = "0.28.1" }
4645
nested_enum_utils = { version = "0.1.0", optional = true }
4746
num_cpus = "1.15.0"
4847
oneshot = "0.1.8"
@@ -76,13 +75,12 @@ tracing-futures = "0.2.5"
7675
walkdir = { version = "2.5.0", optional = true }
7776

7877
# Examples
79-
iroh = { version = "0.28", optional = true }
8078
console = { version = "0.15.8", optional = true }
8179

8280
[dev-dependencies]
8381
http-body = "1.0"
8482
iroh-test = { version = "0.28" }
85-
iroh-net = { version = "0.28", features = ["test-utils"] }
83+
iroh = { version = "0.28", features = ["test-utils"] }
8684
futures-buffered = "0.2.4"
8785
proptest = "1.0.0"
8886
serde_json = "1.0.107"
@@ -116,7 +114,12 @@ rpc = [
116114
"downloader",
117115
]
118116

119-
example-iroh = ["dep:iroh", "dep:clap", "dep:indicatif", "dep:console"]
117+
example-iroh = [
118+
"dep:clap",
119+
"dep:indicatif",
120+
"dep:console",
121+
"iroh/discovery-local-network"
122+
]
120123

121124
[package.metadata.docs.rs]
122125
all-features = true
@@ -177,8 +180,6 @@ panic = 'abort'
177180
incremental = false
178181

179182
[patch.crates-io]
180-
iroh-router = { git = "https://github.com/n0-computer/iroh", branch = "main" }
181-
iroh-net = { git = "https://github.com/n0-computer/iroh", branch = "main" }
182183
iroh-metrics = { git = "https://github.com/n0-computer/iroh", branch = "main" }
183184
iroh-base = { git = "https://github.com/n0-computer/iroh", branch = "main" }
184185
iroh = { git = "https://github.com/n0-computer/iroh", branch = "main" }

deny.toml

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ allow = [
1818
"ISC",
1919
"MIT",
2020
"OpenSSL",
21-
"Unicode-DFS-2016",
2221
"Zlib",
2322
"MPL-2.0", # https://fossa.com/blog/open-source-software-licenses-101-mozilla-public-license-2-0/
2423
"Unicode-3.0"

examples/custom-protocol.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,12 @@ use anyhow::Result;
4444
use clap::Parser;
4545
use futures_lite::future::Boxed as BoxedFuture;
4646
use iroh::{
47-
net::{
48-
endpoint::{get_remote_node_id, Connecting},
49-
Endpoint, NodeId,
50-
},
51-
router::ProtocolHandler,
47+
endpoint::{get_remote_node_id, Connecting},
48+
protocol::{ProtocolHandler, Router},
49+
Endpoint, NodeId,
5250
};
5351
use iroh_base::hash::Hash;
5452
use iroh_blobs::{net_protocol::Blobs, rpc::client::blobs::MemClient, util::local_pool::LocalPool};
55-
use iroh_router::Router;
5653
use tracing_subscriber::{prelude::*, EnvFilter};
5754

5855
#[derive(Debug, Parser)]

examples/hello-world-fetch.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
use std::{env, str::FromStr};
77

88
use anyhow::{bail, ensure, Context, Result};
9-
use iroh::base::ticket::BlobTicket;
9+
use iroh::{protocol::Router, Endpoint};
10+
use iroh_base::ticket::BlobTicket;
1011
use iroh_blobs::{net_protocol::Blobs, util::local_pool::LocalPool, BlobFormat};
11-
use iroh_net::Endpoint;
12-
use iroh_router::Router;
1312
use tracing_subscriber::{prelude::*, EnvFilter};
1413

1514
// set the RUST_LOG env var to one of {debug,info,warn} to see logging info

examples/hello-world-provide.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
//! This is using an in memory database and a random node id.
44
//! run this example from the project root:
55
//! $ cargo run --example hello-world-provide
6+
use iroh::{protocol::Router, Endpoint};
67
use iroh_base::{node_addr::AddrInfoOptions, ticket::BlobTicket};
78
use iroh_blobs::{net_protocol::Blobs, util::local_pool::LocalPool};
8-
use iroh_net::Endpoint;
9-
use iroh_router::Router;
109
use tracing_subscriber::{prelude::*, EnvFilter};
1110

1211
// set the RUST_LOG env var to one of {debug,info,warn} to see logging info

examples/local-swarm-discovery.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ use std::path::PathBuf;
1010
use anyhow::ensure;
1111
use clap::{Parser, Subcommand};
1212
use iroh::{
13-
base::{hash::Hash, key::SecretKey},
14-
net::{discovery::local_swarm_discovery::LocalSwarmDiscovery, key::PublicKey, NodeAddr},
13+
discovery::local_swarm_discovery::LocalSwarmDiscovery, key::PublicKey, protocol::Router,
14+
Endpoint, NodeAddr, RelayMode,
1515
};
16+
use iroh_base::{hash::Hash, key::SecretKey};
1617
use iroh_blobs::{
1718
net_protocol::Blobs, rpc::client::blobs::WrapOption, util::local_pool::LocalPool,
1819
};
19-
use iroh_net::{Endpoint, RelayMode};
20-
use iroh_router::Router;
2120
use tracing_subscriber::{prelude::*, EnvFilter};
2221

2322
use self::progress::show_download_progress;

src/cli.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ use indicatif::{
1515
HumanBytes, HumanDuration, MultiProgress, ProgressBar, ProgressDrawTarget, ProgressState,
1616
ProgressStyle,
1717
};
18+
use iroh::{key::PublicKey, relay::RelayUrl, NodeAddr};
1819
use iroh_base::{node_addr::AddrInfoOptions, ticket::BlobTicket};
19-
use iroh_net::{key::PublicKey, relay::RelayUrl, NodeAddr};
2020
use tokio::io::AsyncWriteExt;
2121

2222
use crate::{

src/downloader.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ use std::{
4343

4444
use futures_lite::{future::BoxedLocal, Stream, StreamExt};
4545
use hashlink::LinkedHashSet;
46+
use iroh::{endpoint, Endpoint, NodeAddr, NodeId};
4647
use iroh_base::hash::{BlobFormat, Hash, HashAndFormat};
4748
use iroh_metrics::inc;
48-
use iroh_net::{endpoint, Endpoint, NodeAddr, NodeId};
4949
use tokio::{
5050
sync::{mpsc, oneshot},
5151
task::JoinSet,
@@ -354,7 +354,7 @@ impl Downloader {
354354
{
355355
let me = endpoint.node_id().fmt_short();
356356
let (msg_tx, msg_rx) = mpsc::channel(SERVICE_CHANNEL_CAPACITY);
357-
let dialer = iroh_net::dialer::Dialer::new(endpoint);
357+
let dialer = iroh::dialer::Dialer::new(endpoint);
358358

359359
let create_future = move || {
360360
let getter = get::IoGetter {
@@ -1492,7 +1492,7 @@ impl Queue {
14921492
}
14931493
}
14941494

1495-
impl Dialer for iroh_net::dialer::Dialer {
1495+
impl Dialer for iroh::dialer::Dialer {
14961496
type Connection = endpoint::Connection;
14971497

14981498
fn queue_dial(&mut self, node_id: NodeId) {

src/downloader/get.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//! [`Getter`] implementation that performs requests over [`Connection`]s.
22
//!
3-
//! [`Connection`]: iroh_net::endpoint::Connection
3+
//! [`Connection`]: iroh::endpoint::Connection
44
55
use futures_lite::FutureExt;
6-
use iroh_net::endpoint;
6+
use iroh::endpoint;
77

88
use super::{progress::BroadcastProgressSender, DownloadKind, FailureAction, GetStartFut, Getter};
99
use crate::{
@@ -27,7 +27,7 @@ impl From<GetError> for FailureAction {
2727

2828
/// [`Getter`] implementation that performs requests over [`Connection`]s.
2929
///
30-
/// [`Connection`]: iroh_net::endpoint::Connection
30+
/// [`Connection`]: iroh::endpoint::Connection
3131
pub(crate) struct IoGetter<S: Store> {
3232
pub store: S,
3333
}

src/downloader/test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{
66

77
use anyhow::anyhow;
88
use futures_util::future::FutureExt;
9-
use iroh_net::key::SecretKey;
9+
use iroh::key::SecretKey;
1010

1111
use super::*;
1212
use crate::{

src/get.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use std::{
2020

2121
use anyhow::Result;
2222
use bao_tree::{io::fsm::BaoContentItem, ChunkNum};
23-
use iroh_net::endpoint::{self, RecvStream, SendStream};
23+
use iroh::endpoint::{self, RecvStream, SendStream};
2424
use serde::{Deserialize, Serialize};
2525
use tracing::{debug, error};
2626

@@ -66,8 +66,8 @@ pub mod fsm {
6666
BaoTree, ChunkRanges, TreeNode,
6767
};
6868
use derive_more::From;
69+
use iroh::endpoint::Connection;
6970
use iroh_io::{AsyncSliceWriter, AsyncStreamReader, TokioStreamReader};
70-
use iroh_net::endpoint::Connection;
7171
use tokio::io::AsyncWriteExt;
7272

7373
use super::*;

src/get/db.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ use genawaiter::{
99
rc::{Co, Gen},
1010
GeneratorState,
1111
};
12+
use iroh::endpoint::Connection;
1213
use iroh_base::hash::Hash;
1314
use iroh_io::AsyncSliceReader;
14-
use iroh_net::endpoint::Connection;
1515
use serde::{Deserialize, Serialize};
1616
use tokio::sync::oneshot;
1717
use tracing::trace;

src/get/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Error returned from get operations
22
3-
use iroh_net::endpoint;
3+
use iroh::endpoint;
44

55
use crate::util::progress::ProgressSendError;
66

src/get/request.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::sync::Arc;
33

44
use bao_tree::{ChunkNum, ChunkRanges};
55
use bytes::Bytes;
6-
use iroh_net::endpoint::Connection;
6+
use iroh::endpoint::Connection;
77
use rand::Rng;
88

99
use super::{fsm, Stats};

src/net_protocol.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ use std::{
1313
use anyhow::{anyhow, bail, Result};
1414
use futures_lite::future::Boxed as BoxedFuture;
1515
use futures_util::future::BoxFuture;
16+
use iroh::{endpoint::Connecting, protocol::ProtocolHandler, Endpoint, NodeAddr};
1617
use iroh_base::hash::{BlobFormat, Hash};
17-
use iroh_net::{endpoint::Connecting, Endpoint, NodeAddr};
18-
use iroh_router::ProtocolHandler;
1918
use serde::{Deserialize, Serialize};
2019
use tracing::{debug, warn};
2120

src/protocol.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@
339339
//! keep a connection open and reuse it for multiple requests.
340340
use bao_tree::{ChunkNum, ChunkRanges};
341341
use derive_more::From;
342-
use iroh_net::endpoint::VarInt;
342+
use iroh::endpoint::VarInt;
343343
use serde::{Deserialize, Serialize};
344344
mod range_spec;
345345
pub use range_spec::{NonEmptyRequestRangeSpecIter, RangeSpec, RangeSpecSeq};
@@ -432,8 +432,8 @@ pub enum Closed {
432432
/// [`RecvStream::stop`]. We don't use this explicitly but this is here as
433433
/// documentation as to what happened to `0`.
434434
///
435-
/// [`RecvStream`]: iroh_net::endpoint::RecvStream
436-
/// [`RecvStream::stop`]: iroh_net::endpoint::RecvStream::stop
435+
/// [`RecvStream`]: iroh::endpoint::RecvStream
436+
/// [`RecvStream::stop`]: iroh::endpoint::RecvStream::stop
437437
StreamDropped = 0,
438438
/// The provider is terminating.
439439
///

src/provider.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ use bao_tree::io::{
77
EncodeError,
88
};
99
use futures_lite::future::Boxed as BoxFuture;
10+
use iroh::endpoint::{self, RecvStream, SendStream};
1011
use iroh_io::{
1112
stats::{SliceReaderStats, StreamWriterStats, TrackingSliceReader, TrackingStreamWriter},
1213
AsyncSliceReader, AsyncStreamWriter, TokioStreamWriter,
1314
};
14-
use iroh_net::endpoint::{self, RecvStream, SendStream};
1515
use serde::{Deserialize, Serialize};
1616
use tracing::{debug, debug_span, info, trace, warn};
1717
use tracing_futures::Instrument;

src/rpc/client/blobs.rs

+12-13
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ use bytes::Bytes;
7070
use futures_lite::{Stream, StreamExt};
7171
use futures_util::SinkExt;
7272
use genawaiter::sync::{Co, Gen};
73-
use iroh_net::NodeAddr;
73+
use iroh::NodeAddr;
7474
use portable_atomic::{AtomicU64, Ordering};
7575
use quic_rpc::{
7676
client::{BoxStreamSync, BoxedConnector},
@@ -991,8 +991,8 @@ pub struct DownloadOptions {
991991
mod tests {
992992
use std::{path::Path, time::Duration};
993993

994+
use iroh::{key::SecretKey, test_utils::DnsPkarrServer, NodeId, RelayMode};
994995
use iroh_base::{node_addr::AddrInfoOptions, ticket::BlobTicket};
995-
use iroh_net::{key::SecretKey, test_utils::DnsPkarrServer, NodeId, RelayMode};
996996
use node::Node;
997997
use rand::RngCore;
998998
use testresult::TestResult;
@@ -1005,8 +1005,7 @@ mod tests {
10051005
//! An iroh node that just has the blobs transport
10061006
use std::{path::Path, sync::Arc};
10071007

1008-
use iroh_net::{Endpoint, NodeAddr, NodeId};
1009-
use iroh_router::Router;
1008+
use iroh::{protocol::Router, Endpoint, NodeAddr, NodeId};
10101009
use tokio_util::task::AbortOnDropHandle;
10111010

10121011
use super::RpcService;
@@ -1023,7 +1022,7 @@ mod tests {
10231022
/// An iroh node that just has the blobs transport
10241023
#[derive(Debug)]
10251024
pub struct Node {
1026-
router: iroh_router::Router,
1025+
router: iroh::protocol::Router,
10271026
client: RpcClient,
10281027
_local_pool: LocalPool,
10291028
_rpc_task: AbortOnDropHandle<()>,
@@ -1034,7 +1033,7 @@ mod tests {
10341033
pub struct Builder<S> {
10351034
store: S,
10361035
events: EventSender,
1037-
endpoint: Option<iroh_net::endpoint::Builder>,
1036+
endpoint: Option<iroh::endpoint::Builder>,
10381037
}
10391038

10401039
impl<S: crate::store::Store> Builder<S> {
@@ -1047,7 +1046,7 @@ mod tests {
10471046
}
10481047

10491048
/// Set an endpoint builder
1050-
pub fn endpoint(self, endpoint: iroh_net::endpoint::Builder) -> Self {
1049+
pub fn endpoint(self, endpoint: iroh::endpoint::Builder) -> Self {
10511050
Self {
10521051
endpoint: Some(endpoint),
10531052
..self
@@ -1866,13 +1865,13 @@ mod tests {
18661865
#[tokio::test]
18671866
async fn test_download_via_relay() -> Result<()> {
18681867
let _guard = iroh_test::logging::setup();
1869-
let (relay_map, relay_url, _guard) = iroh_net::test_utils::run_relay_server().await?;
1868+
let (relay_map, relay_url, _guard) = iroh::test_utils::run_relay_server().await?;
18701869

1871-
let endpoint1 = iroh_net::Endpoint::builder()
1870+
let endpoint1 = iroh::Endpoint::builder()
18721871
.relay_mode(RelayMode::Custom(relay_map.clone()))
18731872
.insecure_skip_relay_cert_verify(true);
18741873
let node1 = Node::memory().endpoint(endpoint1).spawn().await?;
1875-
let endpoint2 = iroh_net::Endpoint::builder()
1874+
let endpoint2 = iroh::Endpoint::builder()
18761875
.relay_mode(RelayMode::Custom(relay_map.clone()))
18771876
.insecure_skip_relay_cert_verify(true);
18781877
let node2 = Node::memory().endpoint(endpoint2).spawn().await?;
@@ -1897,19 +1896,19 @@ mod tests {
18971896
#[ignore = "flaky"]
18981897
async fn test_download_via_relay_with_discovery() -> Result<()> {
18991898
let _guard = iroh_test::logging::setup();
1900-
let (relay_map, _relay_url, _guard) = iroh_net::test_utils::run_relay_server().await?;
1899+
let (relay_map, _relay_url, _guard) = iroh::test_utils::run_relay_server().await?;
19011900
let dns_pkarr_server = DnsPkarrServer::run().await?;
19021901

19031902
let secret1 = SecretKey::generate();
1904-
let endpoint1 = iroh_net::Endpoint::builder()
1903+
let endpoint1 = iroh::Endpoint::builder()
19051904
.relay_mode(RelayMode::Custom(relay_map.clone()))
19061905
.insecure_skip_relay_cert_verify(true)
19071906
.dns_resolver(dns_pkarr_server.dns_resolver())
19081907
.secret_key(secret1.clone())
19091908
.discovery(dns_pkarr_server.discovery(secret1));
19101909
let node1 = Node::memory().endpoint(endpoint1).spawn().await?;
19111910
let secret2 = SecretKey::generate();
1912-
let endpoint2 = iroh_net::Endpoint::builder()
1911+
let endpoint2 = iroh::Endpoint::builder()
19131912
.relay_mode(RelayMode::Custom(relay_map.clone()))
19141913
.insecure_skip_relay_cert_verify(true)
19151914
.dns_resolver(dns_pkarr_server.dns_resolver())

src/util/fs.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -126,20 +126,20 @@ pub fn relative_canonicalized_path_to_string(path: impl AsRef<Path>) -> anyhow::
126126
canonicalized_path_to_string(path, true)
127127
}
128128

129-
/// Loads a [`iroh_net::key::SecretKey`] from the provided file, or stores a newly generated one
129+
/// Loads a [`iroh::key::SecretKey`] from the provided file, or stores a newly generated one
130130
/// at the given location.
131131
#[cfg(feature = "rpc")]
132132
#[cfg_attr(iroh_docsrs, doc(cfg(feature = "rpc")))]
133-
pub async fn load_secret_key(key_path: PathBuf) -> anyhow::Result<iroh_net::key::SecretKey> {
133+
pub async fn load_secret_key(key_path: PathBuf) -> anyhow::Result<iroh::key::SecretKey> {
134134
use tokio::io::AsyncWriteExt;
135135

136136
if key_path.exists() {
137137
let keystr = tokio::fs::read(key_path).await?;
138138
let secret_key =
139-
iroh_net::key::SecretKey::try_from_openssh(keystr).context("invalid keyfile")?;
139+
iroh::key::SecretKey::try_from_openssh(keystr).context("invalid keyfile")?;
140140
Ok(secret_key)
141141
} else {
142-
let secret_key = iroh_net::key::SecretKey::generate();
142+
let secret_key = iroh::key::SecretKey::generate();
143143
let ser_key = secret_key.to_openssh()?;
144144

145145
// Try to canonicalize if possible

0 commit comments

Comments
 (0)