Skip to content

Commit 3feb779

Browse files
authored
Merge c7b8246 into 2b92db4
2 parents 2b92db4 + c7b8246 commit 3feb779

File tree

7 files changed

+360
-47
lines changed

7 files changed

+360
-47
lines changed

iroh/examples/dht_discovery.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use std::str::FromStr;
1212

1313
use clap::Parser;
14-
use iroh::{endpoint::get_remote_node_id, Endpoint, NodeId};
14+
use iroh::{Endpoint, NodeId};
1515
use tracing::warn;
1616
use url::Url;
1717

@@ -88,7 +88,7 @@ async fn chat_server(args: Args) -> anyhow::Result<()> {
8888
};
8989
tokio::spawn(async move {
9090
let connection = connecting.await?;
91-
let remote_node_id = get_remote_node_id(&connection)?;
91+
let remote_node_id = connection.remote_node_id()?;
9292
println!("got connection from {}", remote_node_id);
9393
// just leave the tasks hanging. this is just an example.
9494
let (mut writer, mut reader) = connection.accept_bi().await?;

iroh/examples/echo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl ProtocolHandler for Echo {
7777
// Wait for the connection to be fully established.
7878
let connection = connecting.await?;
7979
// We can get the remote's node id from the connection.
80-
let node_id = iroh::endpoint::get_remote_node_id(&connection)?;
80+
let node_id = connection.remote_node_id()?;
8181
println!("accepted connection from {node_id}");
8282

8383
// Our protocol is a simple request-response protocol, so we expect the

iroh/examples/listen-unreliable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ async fn main() -> anyhow::Result<()> {
6969
};
7070
let alpn = connecting.alpn().await?;
7171
let conn = connecting.await?;
72-
let node_id = iroh::endpoint::get_remote_node_id(&conn)?;
72+
let node_id = conn.remote_node_id()?;
7373
info!(
7474
"new (unreliable) connection from {node_id} with ALPN {} (coming from {})",
7575
String::from_utf8_lossy(&alpn),

iroh/examples/listen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ async fn main() -> anyhow::Result<()> {
7070
};
7171
let alpn = connecting.alpn().await?;
7272
let conn = connecting.await?;
73-
let node_id = iroh::endpoint::get_remote_node_id(&conn)?;
73+
let node_id = conn.remote_node_id()?;
7474
info!(
7575
"new connection from {node_id} with ALPN {} (coming from {})",
7676
String::from_utf8_lossy(&alpn),

iroh/examples/search.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use anyhow::Result;
3535
use clap::Parser;
3636
use futures_lite::future::Boxed as BoxedFuture;
3737
use iroh::{
38-
endpoint::{get_remote_node_id, Connecting},
38+
endpoint::Connecting,
3939
protocol::{ProtocolHandler, Router},
4040
Endpoint, NodeId,
4141
};
@@ -134,7 +134,7 @@ impl ProtocolHandler for BlobSearch {
134134
// Wait for the connection to be fully established.
135135
let connection = connecting.await?;
136136
// We can get the remote's node id from the connection.
137-
let node_id = get_remote_node_id(&connection)?;
137+
let node_id = connection.remote_node_id()?;
138138
println!("accepted connection from {node_id}");
139139

140140
// Our protocol is a simple request-response protocol, so we expect the

iroh/examples/transfer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ async fn provide(
179179
}
180180
};
181181
let conn = connecting.await?;
182-
let node_id = iroh::endpoint::get_remote_node_id(&conn)?;
182+
let node_id = conn.remote_node_id()?;
183183
info!(
184184
"new connection from {node_id} with ALPN {} (coming from {})",
185185
String::from_utf8_lossy(TRANSFER_ALPN),

0 commit comments

Comments
 (0)