Description AddrStream offers a remote_addr() method that returns the remote (peer) address of the connection. But there's no equivalent local_addr() method. TcpStream has such a method, but the only way to get that from AddrStream is AddrStream::to_inner() that consumes the AddrStream entirely (which is to say, there's no as_inner() method to get a reference).
This is really frustrating because I want to log the local IP address on incoming connections (I'm listening on 0.0.0.0 and I want to know which interface the connection is coming in on). So I either need an AddrStream::local_addr() method or I need an AddrStream::as_inner() method1 that I can then use to call TcpStream::local_addr().
Footnotes
Or maybe an <AddrStream as AsRef<TcpStream>> impl. ↩
The text was updated successfully, but these errors were encountered:
Version
hyper v0.14.17
Description
AddrStream
offers aremote_addr()
method that returns the remote (peer) address of the connection. But there's no equivalentlocal_addr()
method.TcpStream
has such a method, but the only way to get that fromAddrStream
isAddrStream::to_inner()
that consumes theAddrStream
entirely (which is to say, there's noas_inner()
method to get a reference).This is really frustrating because I want to log the local IP address on incoming connections (I'm listening on
0.0.0.0
and I want to know which interface the connection is coming in on). So I either need anAddrStream::local_addr()
method or I need anAddrStream::as_inner()
method1 that I can then use to callTcpStream::local_addr()
.Footnotes
Or maybe an↩
<AddrStream as AsRef<TcpStream>>
impl.The text was updated successfully, but these errors were encountered: