softprops / hyperlocal

🔌 ✨rustlang hyper bindings for local unix domain sockets
MIT License
227 stars 46 forks source link

Thoughts about making UnixStream public #50

Closed Mythra closed 1 week ago

Mythra commented 3 years ago

👋 I'm looking at using this logic as part of my own HTTP Client, and I was hoping to get access to the UnixStream type: https://github.com/softprops/hyperlocal/blob/main/src/client.rs#L19.

The main reason i'm doing this all is to honestly have hyper tuned error reporting. Certain IO Error codes mean certain things depending on the stream type, and by wrapping everything in my own custom enums I can make decisions/keep state about the streams, connectors, etc. In any part of my codebase.

I realize most people get fine without it though, and I imagine it was made private for a reason, so I just wanted to see if there was any chance we could start exporting that type.

onalante-msft commented 2 years ago

The choice to keep the inner UnixStream private seems to match what hyper does with AddrStream: reference. Though the latter type does have an into_inner to get the backing TcpStream, it would not be usable in a MakeServiceRef implementor. Your application could certainly be doing something else... Is this a capability that you are currently using with AddrStream (or similar)? UnixStream could probably implement into_inner, if so.

@fnichol Just in case.

yu-re-ka commented 2 years ago

hyper does not expose the inner TcpStream, but the AddrStream itself is exposed in the public interface? For my use case, I wrap UnixConnector and UnixStream into my own enum types together with other connectors / streams. I would think it is quite common to support both unix and other uris in one hyper client?

onalante-msft commented 1 year ago

Oh, I completely missed that UnixStream was not exported from lib.rs. My sincere apologies about that! I should have looked more closely at the export declarations.

I agree that making UnixStream public would be most consistent with hyper.

@softprops Would you like to delegate maintenance of this project to help manage some of the outstanding PRs?