Skip to content

Commit 08bd2a1

Browse files
authored
feat(iroh)!: Remove access to local and remote IP addresses (#3148)
## Description The Connecting and Connection structs exposed IP addresses, these are probably the NodeIdMappedAddresses rather than real ones. We address based on NodeId, so let's remove this stuff. ## Breaking Changes ### iroh - `Connecting::local_ip` is removed. - `Connecting::remote_address` is removed. - `Connection::local_ip` is removed. - `Connection::remote_address` is removed. ## Notes & open questions I didn't think long about this. Getting this PR out so someone else can think carefully about this. :) ## Change checklist - [ ] Self-review. - [ ] 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. - [ ] All breaking changes documented.
1 parent 2e61ff2 commit 08bd2a1

File tree

4 files changed

+3
-38
lines changed

4 files changed

+3
-38
lines changed

iroh/examples/listen-unreliable.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,8 @@ async fn main() -> anyhow::Result<()> {
7171
let conn = connecting.await?;
7272
let node_id = conn.remote_node_id()?;
7373
info!(
74-
"new (unreliable) connection from {node_id} with ALPN {} (coming from {})",
74+
"new (unreliable) connection from {node_id} with ALPN {}",
7575
String::from_utf8_lossy(&alpn),
76-
conn.remote_address()
7776
);
7877
// spawn a task to handle reading and writing off of the connection
7978
tokio::spawn(async move {

iroh/examples/listen.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ async fn main() -> anyhow::Result<()> {
7272
let conn = connecting.await?;
7373
let node_id = conn.remote_node_id()?;
7474
info!(
75-
"new connection from {node_id} with ALPN {} (coming from {})",
75+
"new connection from {node_id} with ALPN {}",
7676
String::from_utf8_lossy(&alpn),
77-
conn.remote_address()
7877
);
7978

8079
// spawn a task to handle reading and writing off of the connection

iroh/examples/transfer.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,8 @@ async fn provide(
181181
let conn = connecting.await?;
182182
let node_id = conn.remote_node_id()?;
183183
info!(
184-
"new connection from {node_id} with ALPN {} (coming from {})",
184+
"new connection from {node_id} with ALPN {}",
185185
String::from_utf8_lossy(TRANSFER_ALPN),
186-
conn.remote_address()
187186
);
188187

189188
// spawn a task to handle reading and writing off of the connection

iroh/src/endpoint.rs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,16 +1282,6 @@ impl Connecting {
12821282
self.inner.handshake_data().await
12831283
}
12841284

1285-
/// The local IP address which was used when the peer established the connection.
1286-
pub fn local_ip(&self) -> Option<IpAddr> {
1287-
self.inner.local_ip()
1288-
}
1289-
1290-
/// The peer's UDP address.
1291-
pub fn remote_address(&self) -> SocketAddr {
1292-
self.inner.remote_address()
1293-
}
1294-
12951285
/// Extracts the ALPN protocol from the peer's handshake data.
12961286
// Note, we could totally provide this method to be on a Connection as well. But we'd
12971287
// need to wrap Connection too.
@@ -1499,28 +1489,6 @@ impl Connection {
14991489
self.inner.datagram_send_buffer_space()
15001490
}
15011491

1502-
/// The peer's UDP address.
1503-
///
1504-
/// If [`ServerConfig::migration`] is `true`, clients may change addresses at will,
1505-
/// e.g. when switching to a cellular internet connection.
1506-
#[inline]
1507-
pub fn remote_address(&self) -> SocketAddr {
1508-
self.inner.remote_address()
1509-
}
1510-
1511-
/// The local IP address which was used when the peer established the connection.
1512-
///
1513-
/// This can be different from the address the endpoint is bound to, in case the
1514-
/// endpoint is bound to a wildcard address like `0.0.0.0` or `::`.
1515-
///
1516-
/// This will return `None` for clients, or when the platform does not expose this
1517-
/// information. See [`quinn::udp::RecvMeta::dst_ip`] for a list of supported
1518-
/// platforms.
1519-
#[inline]
1520-
pub fn local_ip(&self) -> Option<IpAddr> {
1521-
self.inner.local_ip()
1522-
}
1523-
15241492
/// Current best estimate of this connection's latency (round-trip-time).
15251493
#[inline]
15261494
pub fn rtt(&self) -> Duration {

0 commit comments

Comments
 (0)