File tree 7 files changed +360
-47
lines changed
7 files changed +360
-47
lines changed Original file line number Diff line number Diff line change 11
11
use std:: str:: FromStr ;
12
12
13
13
use clap:: Parser ;
14
- use iroh:: { endpoint :: get_remote_node_id , Endpoint , NodeId } ;
14
+ use iroh:: { Endpoint , NodeId } ;
15
15
use tracing:: warn;
16
16
use url:: Url ;
17
17
@@ -88,7 +88,7 @@ async fn chat_server(args: Args) -> anyhow::Result<()> {
88
88
} ;
89
89
tokio:: spawn ( async move {
90
90
let connection = connecting. await ?;
91
- let remote_node_id = get_remote_node_id ( & connection) ?;
91
+ let remote_node_id = connection. remote_node_id ( ) ?;
92
92
println ! ( "got connection from {}" , remote_node_id) ;
93
93
// just leave the tasks hanging. this is just an example.
94
94
let ( mut writer, mut reader) = connection. accept_bi ( ) . await ?;
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ impl ProtocolHandler for Echo {
77
77
// Wait for the connection to be fully established.
78
78
let connection = connecting. await ?;
79
79
// 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 ( ) ?;
81
81
println ! ( "accepted connection from {node_id}" ) ;
82
82
83
83
// Our protocol is a simple request-response protocol, so we expect the
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ async fn main() -> anyhow::Result<()> {
69
69
} ;
70
70
let alpn = connecting. alpn ( ) . await ?;
71
71
let conn = connecting. await ?;
72
- let node_id = iroh :: endpoint :: get_remote_node_id ( & conn) ?;
72
+ let node_id = conn. remote_node_id ( ) ?;
73
73
info ! (
74
74
"new (unreliable) connection from {node_id} with ALPN {} (coming from {})" ,
75
75
String :: from_utf8_lossy( & alpn) ,
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ async fn main() -> anyhow::Result<()> {
70
70
} ;
71
71
let alpn = connecting. alpn ( ) . await ?;
72
72
let conn = connecting. await ?;
73
- let node_id = iroh :: endpoint :: get_remote_node_id ( & conn) ?;
73
+ let node_id = conn. remote_node_id ( ) ?;
74
74
info ! (
75
75
"new connection from {node_id} with ALPN {} (coming from {})" ,
76
76
String :: from_utf8_lossy( & alpn) ,
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ use anyhow::Result;
35
35
use clap:: Parser ;
36
36
use futures_lite:: future:: Boxed as BoxedFuture ;
37
37
use iroh:: {
38
- endpoint:: { get_remote_node_id , Connecting } ,
38
+ endpoint:: Connecting ,
39
39
protocol:: { ProtocolHandler , Router } ,
40
40
Endpoint , NodeId ,
41
41
} ;
@@ -134,7 +134,7 @@ impl ProtocolHandler for BlobSearch {
134
134
// Wait for the connection to be fully established.
135
135
let connection = connecting. await ?;
136
136
// 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 ( ) ?;
138
138
println ! ( "accepted connection from {node_id}" ) ;
139
139
140
140
// Our protocol is a simple request-response protocol, so we expect the
Original file line number Diff line number Diff line change @@ -179,7 +179,7 @@ async fn provide(
179
179
}
180
180
} ;
181
181
let conn = connecting. await ?;
182
- let node_id = iroh :: endpoint :: get_remote_node_id ( & conn) ?;
182
+ let node_id = conn. remote_node_id ( ) ?;
183
183
info ! (
184
184
"new connection from {node_id} with ALPN {} (coming from {})" ,
185
185
String :: from_utf8_lossy( TRANSFER_ALPN ) ,
You can’t perform that action at this time.
0 commit comments