Skip to content

Commit 95bcb62

Browse files
authored
feat(iroh, iroh-relay)!: Remove Endpoint::connect_by_node_id and add #[doc(cfg(...))] annotations (#3015)
## Description <!-- A summary of what this pull request achieves and a rough list of changes. --> We've deprecated this method a while ago, said to remove it in v0.28.0, but didn't. Let's do that now. Also, I noticed some `#[doc(cfg(..))]`s were missing, I tried to find and add all missing ones. ## Breaking Changes - Removed deprecated `iroh::Endpoint::connect_by_node_id`. Use `iroh::Endpoint::connect` with a `NodeId` instead. ## Change checklist - [x] Self-review. - [x] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - ~~[ ] Tests if relevant.~~ - [x] All breaking changes documented.
1 parent 74884f1 commit 95bcb62

File tree

4 files changed

+7
-15
lines changed

4 files changed

+7
-15
lines changed

iroh-relay/src/protos/relay.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ impl Frame {
289289

290290
/// Serialized length with frame header.
291291
#[cfg(feature = "server")]
292+
#[cfg_attr(iroh_docsrs, doc(cfg(feature = "server")))]
292293
pub(crate) fn len_with_header(&self) -> usize {
293294
self.len() + HEADER_LEN
294295
}

iroh-relay/src/quic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub const QUIC_ADDR_DISC_CLOSE_CODE: VarInt = VarInt::from_u32(1);
1313
pub const QUIC_ADDR_DISC_CLOSE_REASON: &[u8] = b"finished";
1414

1515
#[cfg(feature = "server")]
16+
#[cfg_attr(iroh_docsrs, doc(cfg(feature = "server")))]
1617
pub(crate) mod server {
1718
use quinn::{crypto::rustls::QuicServerConfig, ApplicationClose};
1819
use tokio::task::JoinSet;

iroh-relay/src/server.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ mod http_server;
4848
mod metrics;
4949
pub(crate) mod streams;
5050
#[cfg(feature = "test-utils")]
51+
#[cfg_attr(iroh_docsrs, doc(cfg(feature = "test-utils")))]
5152
pub mod testing;
5253

5354
pub use self::{
@@ -447,6 +448,7 @@ impl Server {
447448
///
448449
/// This uses [`Self::https_addr`] so it's mostly useful for local development.
449450
#[cfg(feature = "test-utils")]
451+
#[cfg_attr(iroh_docsrs, doc(cfg(feature = "test-utils")))]
450452
pub fn https_url(&self) -> Option<RelayUrl> {
451453
self.https_addr.map(|addr| {
452454
url::Url::parse(&format!("https://{addr}"))
@@ -459,6 +461,7 @@ impl Server {
459461
///
460462
/// This uses [`Self::http_addr`] so it's mostly useful for local development.
461463
#[cfg(feature = "test-utils")]
464+
#[cfg_attr(iroh_docsrs, doc(cfg(feature = "test-utils")))]
462465
pub fn http_url(&self) -> Option<RelayUrl> {
463466
self.http_addr.map(|addr| {
464467
url::Url::parse(&format!("http://{addr}"))

iroh/src/endpoint.rs

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ impl Builder {
307307
}
308308

309309
#[cfg(feature = "discovery-pkarr-dht")]
310+
#[cfg_attr(iroh_docsrs, doc(cfg(feature = "discovery-pkarr-dht")))]
310311
/// Configures the endpoint to also use the mainline DHT with default settings.
311312
///
312313
/// This is equivalent to adding a [`crate::discovery::pkarr::dht::DhtDiscovery`]
@@ -327,6 +328,7 @@ impl Builder {
327328
}
328329

329330
#[cfg(feature = "discovery-local-network")]
331+
#[cfg_attr(iroh_docsrs, doc(cfg(feature = "discovery-local-network")))]
330332
/// Configures the endpoint to also use local network discovery.
331333
///
332334
/// This is equivalent to adding a [`crate::discovery::local_swarm_discovery::LocalSwarmDiscovery`]
@@ -620,21 +622,6 @@ impl Endpoint {
620622
conn
621623
}
622624

623-
/// Connects to a remote endpoint, using just the nodes's [`NodeId`].
624-
///
625-
/// This is a convenience function for [`Endpoint::connect`]. It relies on addressing
626-
/// information being provided by either the discovery service or using
627-
/// [`Endpoint::add_node_addr`]. See [`Endpoint::connect`] for the details of how it
628-
/// uses the discovery service to establish a connection to a remote node.
629-
#[deprecated(
630-
since = "0.27.0",
631-
note = "Please use `connect` directly with a NodeId. This fn will be removed in 0.28.0."
632-
)]
633-
pub async fn connect_by_node_id(&self, node_id: NodeId, alpn: &[u8]) -> Result<Connection> {
634-
let addr = NodeAddr::new(node_id);
635-
self.connect(addr, alpn).await
636-
}
637-
638625
#[instrument(
639626
skip_all,
640627
fields(remote_node = node_id.fmt_short(), alpn = %String::from_utf8_lossy(alpn))

0 commit comments

Comments
 (0)