feat(io): `TokioIo<T>: PeerAddr`

Signed-off-by: katelyn martin <kate@buoyant.io>
This commit is contained in:
katelyn martin 2025-02-14 00:00:00 +00:00
parent 28274d2bfc
commit afb351fd14
3 changed files with 9 additions and 0 deletions

View File

@ -1995,6 +1995,7 @@ dependencies = [
"async-trait",
"bytes",
"futures",
"hyper-util",
"linkerd-errno",
"pin-project",
"tokio",

View File

@ -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 }

View File

@ -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()
}
}