Skip to content

Commit f5dae03

Browse files
committed
feat(io): TokioIo<T>: PeerAddr
Signed-off-by: katelyn martin <kate@buoyant.io>
1 parent ed42c2a commit f5dae03

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

Cargo.lock

+1
Original file line numberDiff line numberDiff line change
@@ -1938,6 +1938,7 @@ dependencies = [
19381938
"async-trait",
19391939
"bytes",
19401940
"futures",
1941+
"hyper-util",
19411942
"linkerd-errno",
19421943
"pin-project",
19431944
"tokio",

linkerd/io/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ default = []
1616
async-trait = "0.1"
1717
futures = { version = "0.3", default-features = false }
1818
bytes = { workspace = true }
19+
hyper-util = { workspace = true, features = ["tokio"] }
1920
linkerd-errno = { path = "../errno" }
2021
tokio = { version = "1", features = ["io-util", "net"] }
2122
tokio-test = { version = "0.4", optional = true }

linkerd/io/src/lib.rs

+7
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,10 @@ impl PeerAddr for tokio::io::DuplexStream {
7676
Ok(([0, 0, 0, 0], 0).into())
7777
}
7878
}
79+
80+
impl<T: PeerAddr> PeerAddr for hyper_util::rt::tokio::TokioIo<T> {
81+
#[inline]
82+
fn peer_addr(&self) -> Result<SocketAddr> {
83+
self.inner().peer_addr()
84+
}
85+
}

0 commit comments

Comments
 (0)