Skip to content

Commit

Permalink
feat(io): TokioIo<T>: PeerAddr
Browse files Browse the repository at this point in the history
Signed-off-by: katelyn martin <[email protected]>
  • Loading branch information
cratelyn committed Mar 11, 2025
1 parent ed42c2a commit f5dae03
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1938,6 +1938,7 @@ dependencies = [
"async-trait",
"bytes",
"futures",
"hyper-util",
"linkerd-errno",
"pin-project",
"tokio",
Expand Down
1 change: 1 addition & 0 deletions linkerd/io/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ default = []
async-trait = "0.1"
futures = { version = "0.3", default-features = false }
bytes = { workspace = true }
hyper-util = { workspace = true, features = ["tokio"] }
linkerd-errno = { path = "../errno" }
tokio = { version = "1", features = ["io-util", "net"] }
tokio-test = { version = "0.4", optional = true }
Expand Down
7 changes: 7 additions & 0 deletions linkerd/io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,10 @@ impl PeerAddr for tokio::io::DuplexStream {
Ok(([0, 0, 0, 0], 0).into())
}
}

impl<T: PeerAddr> PeerAddr for hyper_util::rt::tokio::TokioIo<T> {
#[inline]
fn peer_addr(&self) -> Result<SocketAddr> {
self.inner().peer_addr()
}
}

0 comments on commit f5dae03

Please sign in to comment.