diff --git a/Cargo.lock b/Cargo.lock index cfd733f206..6a9e159a48 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1938,6 +1938,7 @@ dependencies = [ "async-trait", "bytes", "futures", + "hyper-util", "linkerd-errno", "pin-project", "tokio", diff --git a/linkerd/io/Cargo.toml b/linkerd/io/Cargo.toml index 0f68e6545d..41f13bab36 100644 --- a/linkerd/io/Cargo.toml +++ b/linkerd/io/Cargo.toml @@ -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 } diff --git a/linkerd/io/src/lib.rs b/linkerd/io/src/lib.rs index aa5997d372..3d50bddd4a 100644 --- a/linkerd/io/src/lib.rs +++ b/linkerd/io/src/lib.rs @@ -76,3 +76,10 @@ impl PeerAddr for tokio::io::DuplexStream { Ok(([0, 0, 0, 0], 0).into()) } } + +impl PeerAddr for hyper_util::rt::tokio::TokioIo { + #[inline] + fn peer_addr(&self) -> Result { + self.inner().peer_addr() + } +}