Skip to content

Commit fa413fc

Browse files
authored
feat(server): Add method to get local addr to TcpIncoming (#2233)
1 parent e0ea5d0 commit fa413fc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tonic/src/transport/server/incoming.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ impl TcpIncoming {
7070
let keepalive = keepalive.map(|t| TcpKeepalive::new().with_time(t));
7171
Self { keepalive, ..self }
7272
}
73+
74+
/// Returns the local address that this tcp incoming is bound to.
75+
pub fn local_addr(&self) -> std::io::Result<SocketAddr> {
76+
self.inner.as_ref().local_addr()
77+
}
7378
}
7479

7580
impl From<TcpListener> for TcpIncoming {

0 commit comments

Comments
 (0)