Skip to content

Commit 2f27904

Browse files
feat: update to [email protected] (#44)
* feat(h3-iroh): update to [email protected] and [email protected] * feat(content-discovery): update to [email protected] * feat(iroh-dag-sync): update to [email protected] * feat(iroh-pkarr-naming-system): update to [email protected] * fixup(h3-iroh): error handling * fixup(h3-iroh): axum * fixup * fixup * cleanup
1 parent f898b87 commit 2f27904

File tree

26 files changed

+1059
-1390
lines changed

26 files changed

+1059
-1390
lines changed

content-discovery/Cargo.lock

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

content-discovery/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ missing_debug_implementations = "warn"
2626
unused-async = "warn"
2727

2828
[workspace.dependencies]
29-
iroh = { version ="0.93", features = ["discovery-pkarr-dht"] }
30-
iroh-base = "0.93"
31-
iroh-blobs = { version = "0.95" }
29+
iroh = { version ="0.94", features = ["discovery-pkarr-dht"] }
30+
iroh-base = "0.94"
31+
iroh-blobs = "0.96"
3232
# explicitly specified until iroh minimal crates issues are solved, see https://github.com/n0-computer/iroh/pull/3255
3333
tokio = { version = "1.44.1" }
3434
tokio-stream = { version = "0.1.17" }
3535
postcard = { version = "1", default-features = false }
3636
anyhow = { version = "1", default-features = false }
37-
n0-future = { version = "0.1.3" }
37+
n0-future = { version = "0.3" }
3838
futures-buffered = { version = "0.2.11" }

content-discovery/iroh-content-discovery-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ anyhow = { workspace = true, features = ["backtrace"] }
1515
futures = { version = "0.3.25" }
1616
clap = { version = "4", features = ["derive"] }
1717
tempfile = { version = "3.4" }
18-
derive_more = { version = "1.0.0-beta.1", features = ["debug", "display", "from", "try_into"] }
18+
derive_more = { version = "2", features = ["debug", "display", "from", "try_into"] }
1919
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
2020
tokio = { version = "1", features = ["io-util", "rt"] }

content-discovery/iroh-content-discovery-cli/src/args.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use std::{fmt::Display, str::FromStr};
33

44
use clap::{Parser, Subcommand};
5-
use iroh::NodeId;
5+
use iroh::EndpointId;
66
use iroh_blobs::{ticket::BlobTicket, Hash, HashAndFormat};
77

88
#[derive(Parser, Debug)]
@@ -69,7 +69,7 @@ impl FromStr for ContentArg {
6969
pub struct AnnounceArgs {
7070
/// trackers to announce to
7171
#[clap(long, required = true)]
72-
pub tracker: Vec<NodeId>,
72+
pub tracker: Vec<EndpointId>,
7373

7474
/// The content to announce.
7575
///
@@ -87,7 +87,7 @@ pub struct AnnounceArgs {
8787
pub struct QueryArgs {
8888
/// the tracker to query
8989
#[clap(long, required = true)]
90-
pub tracker: Vec<NodeId>,
90+
pub tracker: Vec<EndpointId>,
9191

9292
/// The content to find hosts for.
9393
pub content: ContentArg,

content-discovery/iroh-content-discovery-cli/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async fn announce(args: AnnounceArgs) -> anyhow::Result<()> {
2323
};
2424
let content = args.content.hash_and_format();
2525
if let ContentArg::Ticket(ticket) = &args.content {
26-
if ticket.node_addr().node_id != key.public() {
26+
if ticket.addr().id != key.public() {
2727
bail!("ticket does not match the announce secret");
2828
}
2929
}

content-discovery/iroh-content-discovery/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ license = "MIT OR Apache-2.0"
1414
iroh-base = { workspace = true }
1515
iroh-blobs = { workspace = true }
1616
serde = { version = "1", features = ["derive"] }
17-
derive_more = { version = "1.0.0-beta.1", features = ["debug", "display", "from", "try_into"] }
17+
derive_more = { version = "2", features = ["debug", "display", "from", "try_into"] }
1818
serde-big-array = "0.5.1"
1919
hex = "0.4.3"
2020
anyhow = { workspace = true, features = ["backtrace"] }

content-discovery/iroh-content-discovery/src/client.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::{future::Future, result};
22

33
use iroh::{
44
endpoint::{ConnectOptions, Connection},
5-
Endpoint, NodeId,
5+
Endpoint, EndpointId,
66
};
77
use n0_future::{BufferedStreamExt, Stream, StreamExt};
88
use snafu::prelude::*;
@@ -62,9 +62,9 @@ pub enum Error {
6262
backtrace: snafu::Backtrace,
6363
},
6464

65-
#[snafu(display("Failed to get remote node id: {}", source))]
66-
RemoteNodeId {
67-
source: iroh::endpoint::RemoteNodeIdError,
65+
#[snafu(display("Failed to get remote endpoint id: {}", source))]
66+
RemoteEndpointId {
67+
source: iroh::endpoint::RemoteEndpointIdError,
6868
backtrace: snafu::Backtrace,
6969
},
7070
}
@@ -74,10 +74,10 @@ pub type Result<T> = result::Result<T, Error>;
7474
/// Announce to multiple trackers in parallel.
7575
pub fn announce_all(
7676
endpoint: Endpoint,
77-
trackers: impl IntoIterator<Item = NodeId>,
77+
trackers: impl IntoIterator<Item = EndpointId>,
7878
signed_announce: SignedAnnounce,
7979
announce_parallelism: usize,
80-
) -> impl Stream<Item = (NodeId, Result<()>)> {
80+
) -> impl Stream<Item = (EndpointId, Result<()>)> {
8181
n0_future::stream::iter(trackers)
8282
.map(move |tracker| {
8383
let endpoint = endpoint.clone();
@@ -91,31 +91,31 @@ pub fn announce_all(
9191

9292
/// Announce to a tracker.
9393
///
94-
/// You can only announce content you yourself claim to have, to avoid spamming other nodes.
94+
/// You can only announce content you yourself claim to have, to avoid spamming other endpoints.
9595
///
9696
/// `endpoint` is the iroh endpoint to use for announcing.
97-
/// `tracker` is the node id of the tracker to announce to. It must understand the [crate::ALPN] protocol.
97+
/// `tracker` is the endpoint id of the tracker to announce to. It must understand the [crate::ALPN] protocol.
9898
/// `content` is the content to announce.
9999
/// `kind` is the kind of the announcement. We can claim to have the complete data or only some of it.
100100
pub async fn announce(
101101
endpoint: &Endpoint,
102-
node_id: NodeId,
102+
endpoint_id: EndpointId,
103103
signed_announce: SignedAnnounce,
104104
) -> Result<()> {
105105
let connecting = endpoint
106-
.connect_with_opts(node_id, ALPN, ConnectOptions::default())
106+
.connect_with_opts(endpoint_id, ALPN, ConnectOptions::default())
107107
.await
108108
.context(ConnectSnafu)?;
109109
match connecting.into_0rtt() {
110110
Ok((connection, zero_rtt_accepted)) => {
111-
trace!("connected to tracker using possibly 0-rtt: {node_id}");
111+
trace!("connected to tracker using possibly 0-rtt: {endpoint_id}");
112112
announce_conn(&connection, signed_announce, zero_rtt_accepted).await?;
113113
wait_for_session_ticket(connection);
114114
Ok(())
115115
}
116116
Err(connecting) => {
117117
let connection = connecting.await.context(Connect1RttSnafu)?;
118-
trace!("connected to tracker using 1-rtt: {node_id}");
118+
trace!("connected to tracker using 1-rtt: {endpoint_id}");
119119
announce_conn(&connection, signed_announce, async { true }).await?;
120120
connection.close(0u32.into(), b"");
121121
Ok(())
@@ -159,23 +159,23 @@ pub async fn announce_conn(
159159
/// A single query to a tracker, using 0-rtt if possible.
160160
pub async fn query(
161161
endpoint: &Endpoint,
162-
node_id: NodeId,
162+
endpoint_id: EndpointId,
163163
args: Query,
164164
) -> Result<Vec<SignedAnnounce>> {
165165
let connecting = endpoint
166-
.connect_with_opts(node_id, ALPN, ConnectOptions::default())
166+
.connect_with_opts(endpoint_id, ALPN, ConnectOptions::default())
167167
.await
168168
.context(ConnectSnafu)?;
169169
let result = match connecting.into_0rtt() {
170170
Ok((connection, zero_rtt_accepted)) => {
171-
trace!("connected to tracker using possibly 0-rtt: {node_id}");
171+
trace!("connected to tracker using possibly 0-rtt: {endpoint_id}");
172172
let res = query_conn(&connection, args, zero_rtt_accepted).await?;
173173
wait_for_session_ticket(connection);
174174
res
175175
}
176176
Err(connecting) => {
177177
let connection = connecting.await.context(Connect1RttSnafu)?;
178-
trace!("connected to tracker using 1-rtt: {node_id}");
178+
trace!("connected to tracker using 1-rtt: {endpoint_id}");
179179
let res = query_conn(&connection, args, async { true }).await?;
180180
connection.close(0u32.into(), b"");
181181
res
@@ -190,7 +190,7 @@ pub async fn query(
190190
/// use [`query`] instead.
191191
pub fn query_all(
192192
endpoint: Endpoint,
193-
trackers: impl IntoIterator<Item = NodeId>,
193+
trackers: impl IntoIterator<Item = EndpointId>,
194194
args: Query,
195195
query_parallelism: usize,
196196
) -> impl Stream<Item = Result<SignedAnnounce>> {
@@ -223,7 +223,7 @@ pub async fn query_conn(
223223
let request = postcard::to_stdvec(&request).context(SerializeRequestSnafu)?;
224224
trace!(
225225
"connected to {:?}",
226-
connection.remote_node_id().context(RemoteNodeIdSnafu)?
226+
connection.remote_id().context(RemoteEndpointIdSnafu)?
227227
);
228228
trace!("opened bi stream");
229229
let (mut send, recv) = connection.open_bi().await.context(OpenStreamSnafu)?;

content-discovery/iroh-content-discovery/src/protocol.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::{
55
time::{Duration, SystemTime},
66
};
77

8-
use iroh::NodeId;
8+
use iroh::EndpointId;
99
use iroh_blobs::HashAndFormat;
1010
use serde::{Deserialize, Serialize};
1111
use serde_big_array::BigArray;
@@ -89,7 +89,7 @@ impl From<AbsoluteTime> for SystemTime {
8989
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
9090
pub struct Announce {
9191
/// The peer that supposedly has the data.
92-
pub host: NodeId,
92+
pub host: EndpointId,
9393
/// The content that the peer claims to have.
9494
pub content: HashAndFormat,
9595
/// The kind of the announcement.
@@ -121,12 +121,8 @@ impl Deref for SignedAnnounce {
121121

122122
#[derive(Debug, Snafu)]
123123
pub enum VerifyError {
124-
SignatureError {
125-
source: ed25519_dalek::SignatureError,
126-
},
127-
SerializationError {
128-
source: postcard::Error,
129-
},
124+
SignatureError { source: iroh_base::SignatureError },
125+
SerializationError { source: postcard::Error },
130126
}
131127

132128
impl SignedAnnounce {

content-discovery/iroh-content-tracker/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ anyhow = { workspace = true, features = ["backtrace"] }
1212
# needs to keep updated with the dep of iroh-blobs
1313
bao-tree = { version = "0.15.1", features = ["tokio_fsm"], default-features = false }
1414
bytes = "1"
15-
derive_more = { version = "1", features = ["debug", "display", "from", "try_into"] }
15+
derive_more = { version = "2", features = ["debug", "display", "from", "try_into"] }
1616
dirs-next = "2"
1717
futures = "0.3.25"
1818
hex = "0.4.3"
@@ -21,14 +21,14 @@ iroh = { workspace = true }
2121
iroh-blobs = { workspace = true }
2222
postcard = { workspace = true, features = ["alloc", "use-std"] }
2323
rand = "0.9.2"
24-
rcgen = "0.12.0"
25-
redb = "1.5.0"
24+
rcgen = "0.14"
25+
redb = "2.6"
2626
serde = { version = "1", features = ["derive"] }
2727
serde_json = "1.0.107"
2828
tempfile = "3.4"
2929
tokio = { version = "1", features = ["io-util", "rt"] }
3030
tokio-util = { version = "0.7", features = ["io-util", "io", "rt"] }
31-
toml = "0.7.3"
31+
toml = "0.9"
3232
tracing = "0.1"
3333
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
3434
ttl_cache = "0.5.1"

content-discovery/iroh-content-tracker/src/io.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::{
88
};
99

1010
use anyhow::Context;
11-
use iroh::NodeId;
11+
use iroh::EndpointId;
1212
use iroh_blobs::{get::Stats, HashAndFormat};
1313
use iroh_content_discovery::protocol::{AnnounceKind, SignedAnnounce};
1414
use serde::{de::DeserializeOwned, Deserialize, Serialize};
@@ -28,7 +28,7 @@ pub const TRACKER_HOME_ENV_VAR: &str = "IROH_TRACKER_HOME";
2828
/// This should be easy to edit manually when serialized as json or toml.
2929
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
3030
pub struct AnnounceData(
31-
pub BTreeMap<HashAndFormat, BTreeMap<AnnounceKind, BTreeMap<NodeId, SignedAnnounce>>>,
31+
pub BTreeMap<HashAndFormat, BTreeMap<AnnounceKind, BTreeMap<EndpointId, SignedAnnounce>>>,
3232
);
3333

3434
pub fn save_to_file(data: impl Serialize, path: &Path) -> anyhow::Result<()> {
@@ -89,7 +89,7 @@ pub fn load_from_file<T: DeserializeOwned + Default>(path: &Path) -> anyhow::Res
8989

9090
pub fn log_connection_attempt(
9191
path: &Option<PathBuf>,
92-
host: &NodeId,
92+
host: &EndpointId,
9393
t0: Instant,
9494
outcome: &Result<iroh::endpoint::Connection, iroh::endpoint::ConnectError>,
9595
) -> anyhow::Result<()> {
@@ -121,7 +121,7 @@ pub fn log_connection_attempt(
121121

122122
pub fn log_probe_attempt(
123123
path: &Option<PathBuf>,
124-
host: &NodeId,
124+
host: &EndpointId,
125125
content: &HashAndFormat,
126126
kind: ProbeKind,
127127
t0: Instant,

0 commit comments

Comments
 (0)