@@ -2,7 +2,7 @@ use std::{future::Future, result};
22
33use iroh:: {
44 endpoint:: { ConnectOptions , Connection } ,
5- Endpoint , NodeId ,
5+ Endpoint , EndpointId ,
66} ;
77use n0_future:: { BufferedStreamExt , Stream , StreamExt } ;
88use 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.
7575pub 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.
100100pub 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.
160160pub 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.
191191pub 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 ) ?;
0 commit comments