Skip to content

Can't get local address of AddrStream #2773

Closed
@lilyball

Description

@lilyball

Version
hyper v0.14.17

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

  1. Or maybe an <AddrStream as AsRef<TcpStream>> impl.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug. Something is wrong. This is bad!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions