Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we convert unix::SocketAddr to/from std::os::unix::net::SocketAddr? #6864

Closed
nmathewson opened this issue Sep 24, 2024 · 1 comment · Fixed by #6868
Closed

Can we convert unix::SocketAddr to/from std::os::unix::net::SocketAddr? #6864

nmathewson opened this issue Sep 24, 2024 · 1 comment · Fixed by #6868
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request. M-net Module: tokio/net

Comments

@nmathewson
Copy link
Contributor

The arti project, for various reasons, needs to convert between tokio::unix::SocketAddr and std::os::unix::net::SocketAddr.

The simplest approach here would be to implement From<.> and Into<.> on tokio::unix::SocketAddr. We'd be happy to write a a patch to do that, but we're wondering if there is some reason not to do so?

As it stands, we've had to make our own conversion function which is a bit ugly, and won't work in the future if Tokio adds support for "abstract" unix SocketAddrs.

Do you have any suggestions here? As noted, we'd be happy to write a patch if there's some approach that would be acceptable on Tokio's end.

@nmathewson nmathewson added A-tokio Area: The main tokio crate C-feature-request Category: A feature request. labels Sep 24, 2024
@Darksonn Darksonn added the M-net Module: tokio/net label Sep 24, 2024
@Darksonn
Copy link
Contributor

This is a historical deficiency due to mio also having a separate SocketAddr type too. However, mio v1 removed its SocketAddr type, so we don't really need to have our own type either. We probably can't get rid of our type, but adding conversions seems fine.

nmathewson added a commit to nmathewson/tokio that referenced this issue Sep 24, 2024
Implement `From` to convert `tokio::unix::SocketAddr` to and from
Rust's `std::os::unix::net::SocketAddr`.

These types were (I'm told) originally separate because `mio` had a
distinct `SocketAddr` type.  This patch makes it possible to
convert between them more easily.

Fixes: tokio-rs#6864
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate C-feature-request Category: A feature request. M-net Module: tokio/net
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants