hyperium / tonic

A native gRPC client & server implementation with async/await support.
https://docs.rs/tonic
MIT License
10.01k stars 1.02k forks source link

Consider use over a Unix domain socket #136

Closed jen20 closed 4 years ago

jen20 commented 5 years ago

As discussed in Discord, it would be useful if Tonic could be used via transports other than TCP sockets - for example a Unix domain socket.

ebkalderon commented 5 years ago

I was just about to open an issue for this. I'm currently using this working branch of hyperlocal to implement a custom Server that serves on Unix domain sockets in a personal project. Converting the client Endpoint, however, is comparatively less trivial.

LucioFranco commented 5 years ago

I am on vacation right now but ill drop a hint at what I think the correct solution should be. We should provide a MakeConnection builder option for both server and client. This MakeConnection should allow us to swap out the underlying asyncread/write.

akshayknarayan commented 4 years ago

Over at https://github.com/akshayknarayan/tonic/commit/02defcd19dc6294de5c3e7f17d903c8aaef1bfef, I've written a temporary hack which addresses this issue in the same way as TLS support - a "unix" feature gate.

This relies on https://crates.io/crates/hyper-unix-connector, which is similar to hyperlocal except it also provides the plumbing needed to make this connector.

This approach probably should not be merged - in fact, @LucioFranco's suggestion of a MakeConnection builder would probably replace the current tls feature gate as well.

danieleades commented 4 years ago

I was just about to open an issue for this. I'm currently using this working branch of hyperlocal to implement a custom Server that serves on Unix domain sockets in a personal project. Converting the client Endpoint, however, is comparatively less trivial.

there's been a bit of churn on hyperlocal. see

what impact does this have on what you're proposing?

akshayknarayan commented 4 years ago

Changes in tonic to allow custom connectors in Endpoint are still necessary - the changes in hyperlocal would have impact on callers passing in custom connectors, but not directly here.

LucioFranco commented 4 years ago

Hey just to update I'd like to get this in tonic for 0.1.