Skip to content

Commit c146f7a

Browse files
feat: update to latest iroh
* feat: update to latest iroh * fix deny.toml
1 parent d4ab8db commit c146f7a

File tree

15 files changed

+457
-304
lines changed

15 files changed

+457
-304
lines changed

Cargo.lock

Lines changed: 420 additions & 257 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ iroh-base = "0.28.0"
3939
iroh-blobs = { version = "0.28.0", optional = true, features = ["downloader"] }
4040
iroh-gossip = { version = "0.28.0", optional = true }
4141
iroh-metrics = { version = "0.28.0", default-features = false }
42-
iroh-net = { version = "0.28.0", optional = true }
43-
iroh-router = { version = "0.28.0", optional = true }
42+
iroh = { version = "0.28", optional = true }
4443
num_enum = "0.7"
4544
postcard = { version = "1", default-features = false, features = ["alloc", "use-std", "experimental-derive"] }
4645
rand = "0.8.5"
@@ -88,10 +87,10 @@ testdir = "0.9.1"
8887

8988
[features]
9089
default = ["net", "metrics", "engine", "rpc", "test-utils"]
91-
net = ["dep:iroh-net", "tokio/io-util", "dep:tokio-stream", "dep:tokio-util"]
92-
metrics = ["iroh-metrics/metrics"]
93-
engine = ["net", "dep:iroh-gossip", "dep:iroh-blobs", "dep:iroh-router"]
94-
test-utils = ["iroh-net/test-utils"]
90+
net = ["dep:iroh", "tokio/io-util", "dep:tokio-stream", "dep:tokio-util"]
91+
metrics = ["iroh-metrics/metrics", "iroh/metrics"]
92+
engine = ["net", "dep:iroh-gossip", "dep:iroh-blobs"]
93+
test-utils = ["iroh/test-utils"]
9594
cli = ["rpc", "dep:clap", "dep:indicatif", "dep:console", "dep:colored", "dep:dialoguer", "dep:shellexpand", "iroh-blobs/rpc"]
9695
rpc = [
9796
"engine",
@@ -107,9 +106,8 @@ all-features = true
107106
rustdoc-args = ["--cfg", "iroh_docsrs"]
108107

109108
[patch.crates-io]
110-
iroh-router = { git = "https://github.com/n0-computer/iroh", branch = "main" }
111-
iroh-net = { git = "https://github.com/n0-computer/iroh", branch = "main" }
112109
iroh-metrics = { git = "https://github.com/n0-computer/iroh", branch = "main" }
113110
iroh-base = { git = "https://github.com/n0-computer/iroh", branch = "main" }
111+
iroh = { git = "https://github.com/n0-computer/iroh", branch = "main" }
114112
iroh-blobs = { git = "https://github.com/n0-computer/iroh-blobs", branch = "main" }
115113
iroh-gossip = { git = "https://github.com/n0-computer/iroh-gossip", branch = "main" }

deny.toml

Lines changed: 0 additions & 1 deletion
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"

src/engine.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ use std::{
1111

1212
use anyhow::{bail, Context, Result};
1313
use futures_lite::{Stream, StreamExt};
14+
use iroh::{key::PublicKey, Endpoint, NodeAddr};
1415
use iroh_blobs::{
1516
downloader::Downloader, store::EntryStatus, util::local_pool::LocalPoolHandle, Hash,
1617
};
1718
use iroh_gossip::net::Gossip;
18-
use iroh_net::{key::PublicKey, Endpoint, NodeAddr};
1919
use serde::{Deserialize, Serialize};
2020
use tokio::sync::{mpsc, oneshot};
2121
use tokio_util::task::AbortOnDropHandle;
@@ -202,10 +202,7 @@ impl<D: iroh_blobs::store::Store> Engine<D> {
202202
}
203203

204204
/// Handle an incoming iroh-docs connection.
205-
pub async fn handle_connection(
206-
&self,
207-
conn: iroh_net::endpoint::Connecting,
208-
) -> anyhow::Result<()> {
205+
pub async fn handle_connection(&self, conn: iroh::endpoint::Connecting) -> anyhow::Result<()> {
209206
self.to_live_actor
210207
.send(ToLiveActor::HandleConnection { conn })
211208
.await?;

src/engine/gossip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use anyhow::{Context, Result};
44
use bytes::Bytes;
55
use futures_lite::StreamExt;
66
use futures_util::FutureExt;
7+
use iroh::NodeId;
78
use iroh_gossip::net::{Event, Gossip, GossipEvent, GossipReceiver, GossipSender, JoinOptions};
8-
use iroh_net::NodeId;
99
use tokio::{
1010
sync::mpsc,
1111
task::{AbortHandle, JoinSet},

src/engine/live.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use std::{
77

88
use anyhow::{Context, Result};
99
use futures_lite::FutureExt;
10+
use iroh::{key::PublicKey, Endpoint, NodeAddr, NodeId};
1011
use iroh_blobs::{
1112
downloader::{DownloadError, DownloadRequest, Downloader},
1213
get::Stats,
@@ -15,7 +16,6 @@ use iroh_blobs::{
1516
};
1617
use iroh_gossip::net::Gossip;
1718
use iroh_metrics::inc;
18-
use iroh_net::{key::PublicKey, Endpoint, NodeAddr, NodeId};
1919
use serde::{Deserialize, Serialize};
2020
use tokio::{
2121
sync::{self, mpsc, oneshot},
@@ -86,7 +86,7 @@ pub enum ToLiveActor {
8686
reply: sync::oneshot::Sender<Result<()>>,
8787
},
8888
HandleConnection {
89-
conn: iroh_net::endpoint::Connecting,
89+
conn: iroh::endpoint::Connecting,
9090
},
9191
AcceptSyncRequest {
9292
namespace: NamespaceId,
@@ -759,7 +759,7 @@ impl<B: iroh_blobs::store::Store> LiveActor<B> {
759759
}
760760

761761
#[instrument("accept", skip_all)]
762-
pub async fn handle_connection(&mut self, conn: iroh_net::endpoint::Connecting) {
762+
pub async fn handle_connection(&mut self, conn: iroh::endpoint::Connecting) {
763763
let to_actor_tx = self.sync_actor_tx.clone();
764764
let accept_request_cb = move |namespace, peer| {
765765
let to_actor_tx = to_actor_tx.clone();

src/engine/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::{
44
};
55

66
use anyhow::Result;
7-
use iroh_net::NodeId;
7+
use iroh::NodeId;
88
use serde::{Deserialize, Serialize};
99
use tracing::{debug, warn};
1010

src/net.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use std::{
55
time::{Duration, Instant},
66
};
77

8+
use iroh::{endpoint::get_remote_node_id, key::PublicKey, Endpoint, NodeAddr};
89
#[cfg(feature = "metrics")]
910
use iroh_metrics::inc;
10-
use iroh_net::{endpoint::get_remote_node_id, key::PublicKey, Endpoint, NodeAddr};
1111
use serde::{Deserialize, Serialize};
1212
use tracing::{debug, error_span, trace, Instrument};
1313

@@ -106,7 +106,7 @@ pub enum AcceptOutcome {
106106
/// Handle an iroh-docs connection and sync all shared documents in the replica store.
107107
pub async fn handle_connection<F, Fut>(
108108
sync: SyncHandle,
109-
connecting: iroh_net::endpoint::Connecting,
109+
connecting: iroh::endpoint::Connecting,
110110
accept_cb: F,
111111
) -> Result<SyncFinished, AcceptError>
112112
where

src/net/codec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::future::Future;
33
use anyhow::{anyhow, ensure};
44
use bytes::{Buf, BufMut, BytesMut};
55
use futures_util::SinkExt;
6-
use iroh_net::key::PublicKey;
6+
use iroh::key::PublicKey;
77
use serde::{Deserialize, Serialize};
88
use tokio::io::{AsyncRead, AsyncWrite};
99
use tokio_stream::StreamExt;
@@ -294,8 +294,8 @@ impl BobState {
294294
#[cfg(test)]
295295
mod tests {
296296
use anyhow::Result;
297+
use iroh::key::SecretKey;
297298
use iroh_base::hash::Hash;
298-
use iroh_net::key::SecretKey;
299299
use rand_core::{CryptoRngCore, SeedableRng};
300300

301301
use super::*;

src/protocol.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ use std::sync::Arc;
44

55
use anyhow::Result;
66
use futures_lite::future::Boxed as BoxedFuture;
7-
use iroh_net::endpoint::Connecting;
8-
use iroh_router::ProtocolHandler;
7+
use iroh::{endpoint::Connecting, protocol::ProtocolHandler};
98

109
use crate::engine::Engine;
1110

src/rpc/client/docs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ use anyhow::{anyhow, Context as _, Result};
1212
use bytes::Bytes;
1313
use derive_more::{Display, FromStr};
1414
use futures_lite::{Stream, StreamExt};
15+
use iroh::NodeAddr;
1516
use iroh_base::node_addr::AddrInfoOptions;
1617
use iroh_blobs::{export::ExportProgress, store::ExportMode, Hash};
17-
use iroh_net::NodeAddr;
1818
use portable_atomic::{AtomicBool, Ordering};
1919
use quic_rpc::{
2020
client::BoxedConnector, message::RpcMsg, transport::flume::FlumeConnector, Connector,

src/rpc/proto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
use std::path::PathBuf;
44

55
use bytes::Bytes;
6+
use iroh::NodeAddr;
67
use iroh_base::node_addr::AddrInfoOptions;
78
use iroh_blobs::{export::ExportProgress, store::ExportMode, Hash};
8-
use iroh_net::NodeAddr;
99
use nested_enum_utils::enum_conversions;
1010
use quic_rpc::pattern::try_server_streaming::StreamCreated;
1111
use quic_rpc_derive::rpc_requests;

src/ticket.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Tickets for [`iroh-docs`] documents.
22
3+
use iroh::NodeAddr;
34
use iroh_base::ticket;
4-
use iroh_net::NodeAddr;
55
use serde::{Deserialize, Serialize};
66

77
use crate::Capability;
@@ -65,8 +65,8 @@ impl std::str::FromStr for DocTicket {
6565
mod tests {
6666
use std::str::FromStr;
6767

68+
use iroh::key::PublicKey;
6869
use iroh_base::base32;
69-
use iroh_net::key::PublicKey;
7070
use iroh_test::{assert_eq_hex, hexdump::parse_hexdump};
7171

7272
use super::*;

tests/sync.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ use anyhow::{anyhow, bail, Context, Result};
1010
use bytes::Bytes;
1111
use futures_lite::Stream;
1212
use futures_util::{FutureExt, StreamExt, TryStreamExt};
13+
use iroh::{
14+
key::{PublicKey, SecretKey},
15+
RelayMode,
16+
};
1317
use iroh_base::node_addr::AddrInfoOptions;
1418
use iroh_blobs::Hash;
1519
use iroh_docs::{
1620
rpc::client::docs::{Doc, Entry, LiveEvent, ShareMode},
1721
store::{DownloadPolicy, FilterKind, Query},
1822
AuthorId, ContentStatus,
1923
};
20-
use iroh_net::{
21-
key::{PublicKey, SecretKey},
22-
RelayMode,
23-
};
2424
use rand::{CryptoRng, Rng, SeedableRng};
2525
use tracing::{debug, error_span, info, Instrument};
2626
use tracing_subscriber::{prelude::*, EnvFilter};
@@ -491,7 +491,7 @@ async fn sync_subscribe_stop_close() -> Result<()> {
491491
#[cfg(feature = "test-utils")]
492492
async fn test_sync_via_relay() -> Result<()> {
493493
let _guard = iroh_test::logging::setup();
494-
let (relay_map, _relay_url, _guard) = iroh_net::test_utils::run_relay_server().await?;
494+
let (relay_map, _relay_url, _guard) = iroh::test_utils::run_relay_server().await?;
495495

496496
let node1 = Node::memory()
497497
.relay_mode(RelayMode::Custom(relay_map.clone()))
@@ -587,9 +587,9 @@ async fn test_sync_via_relay() -> Result<()> {
587587
async fn sync_restart_node() -> Result<()> {
588588
let mut rng = test_rng(b"sync_restart_node");
589589
setup_logging();
590-
let (relay_map, _relay_url, _guard) = iroh_net::test_utils::run_relay_server().await?;
590+
let (relay_map, _relay_url, _guard) = iroh::test_utils::run_relay_server().await?;
591591

592-
let discovery_server = iroh_net::test_utils::DnsPkarrServer::run().await?;
592+
let discovery_server = iroh::test_utils::DnsPkarrServer::run().await?;
593593

594594
let node1_dir = tempfile::TempDir::with_prefix("test-sync_restart_node-node1")?;
595595
let secret_key_1 = SecretKey::generate_with_rng(&mut rng);

tests/util.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ use std::{
99
sync::Arc,
1010
};
1111

12+
use iroh::{discovery::Discovery, dns::DnsResolver, key::SecretKey, NodeId, RelayMode};
1213
use iroh_blobs::{
1314
store::{GcConfig, Store as BlobStore},
1415
util::local_pool::{LocalPool, Run},
1516
};
16-
use iroh_net::{discovery::Discovery, dns::DnsResolver, key::SecretKey, NodeId, RelayMode};
1717
use nested_enum_utils::enum_conversions;
1818
use quic_rpc::transport::{Connector, Listener};
1919
use serde::{Deserialize, Serialize};
@@ -34,7 +34,7 @@ pub const DEFAULT_BIND_ADDR_V6: SocketAddrV6 =
3434
/// An iroh node that just has the blobs transport
3535
#[derive(Debug)]
3636
pub struct Node<S> {
37-
router: iroh_router::Router,
37+
router: iroh::protocol::Router,
3838
client: Client,
3939
store: S,
4040
local_pool: LocalPool,
@@ -126,7 +126,7 @@ impl<S: BlobStore> Builder<S> {
126126
addr_v4.set_port(0);
127127
addr_v6.set_port(0);
128128
}
129-
let mut builder = iroh_net::Endpoint::builder()
129+
let mut builder = iroh::Endpoint::builder()
130130
.bind_addr_v4(addr_v4)
131131
.bind_addr_v6(addr_v6)
132132
.discovery_n0()
@@ -138,15 +138,15 @@ impl<S: BlobStore> Builder<S> {
138138
let endpoint = builder.bind().await?;
139139
let addr = endpoint.node_addr().await?;
140140
let local_pool = LocalPool::single();
141-
let mut router = iroh_router::Router::builder(endpoint.clone());
141+
let mut router = iroh::protocol::Router::builder(endpoint.clone());
142142

143143
// Setup blobs
144144
let downloader = iroh_blobs::downloader::Downloader::new(
145145
store.clone(),
146146
endpoint.clone(),
147147
local_pool.handle().clone(),
148148
);
149-
let blobs = Arc::new(iroh_blobs::net_protocol::Blobs::new_with_events(
149+
let blobs = Arc::new(iroh_blobs::net_protocol::Blobs::new(
150150
store.clone(),
151151
local_pool.handle().clone(),
152152
Default::default(),
@@ -185,12 +185,9 @@ impl<S: BlobStore> Builder<S> {
185185
return Err(err);
186186
}
187187
};
188-
router = router.accept(iroh_blobs::protocol::ALPN.to_vec(), blobs.clone());
189-
router = router.accept(iroh_docs::net::DOCS_ALPN.to_vec(), Arc::new(docs.clone()));
190-
router = router.accept(
191-
iroh_gossip::net::GOSSIP_ALPN.to_vec(),
192-
Arc::new(gossip.clone()),
193-
);
188+
router = router.accept(iroh_blobs::protocol::ALPN, blobs.clone());
189+
router = router.accept(iroh_docs::net::DOCS_ALPN, Arc::new(docs.clone()));
190+
router = router.accept(iroh_gossip::net::GOSSIP_ALPN, Arc::new(gossip.clone()));
194191

195192
// Build the router
196193
let router = router.spawn().await?;

0 commit comments

Comments
 (0)