-
Notifications
You must be signed in to change notification settings - Fork 617
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
grpc-js: Support Unix domain sockets and Named pipes #1244
Conversation
|
Thank you for your pull request. Before we can look at your contribution, we need to ensure all contributors are covered by a Contributor License Agreement. After the following items are addressed, please respond with a new comment here, and the automated system will re-verify.
Regards, |
I'm sorry, we're unlikely to accept this. The API of this library is supposed to match the API of the On the plus side, I have a different change in the works to fix UDS support and the |
The alternate fix I referred to is in #1245. |
The documentation you link to says
Would it then not be strange to support Windows named pipes through the EDIT: I should also say that I like your PR. Feels clean to properly separate IPC addresses from http-over-tcp based addresses. |
It surprises me that gRPC itself specifies address naming schemes at all. Quite limiting to let the protocol library handle the transport layer or express opinions about it. Even more so if it imposes these limitations/requirements on other implementors. |
The point about the Regarding naming schemes, I want to note that that specification does not constrain the gRPC protocol, just the official gRPC libraries. The linked document describes how the gRPC libraries handle and resolve the names passed to them. I don't see the issue with the gRPC libraries handling name resolution and the underlying transport. The Node http2 library automatically does DNS resolution and establishes the underlying TLS or TCP connection used by the http2 session. That seems like the same thing to me. |
Having all IPC under the I agree it's handy that libraries do have handy helper functions for the most common use cases. But to actually be flexible they should also accept an arbitrary IO stream to operate over. So people with not-default use cases can just plug in their transports. So I agree it's nice that the official libraries can handle a number of URIs out of the box, but it should not limit the user to those IMO. |
As I am discovering in my own change, even the built in http2 library doesn't actually make it that easy to just plug in a transport. If you look at the latest version of the PR I linked to, you can see that I still need to set the In the longer run it may be possible for grpc-js to eventually support plugging in transports and/or resolvers, but that's another issue of compatibility with the other implementation. |
Thanks for the feedback! It didn't cross my mind to use "unix:" for Windows Named pipes although it's pretty clear that it works when looking at the code. I don't know where but it would be nice if it is documented somewhere. Your PR looks really good and works well. Thanks for taking the time to implement this! Feel free to close this PR. |
This is an attempt at implementing support for UDS and Named pipes as discussed in #258. I'm not sure if the design of this solution is the way to go here or if there's a better way to do it.
As I understand the http2-library, it isn't able to create a connection over a Unix domain socket or a Named pipe. To solve that I opened a connection using the net-library and supplied that connection to
http2.connect
, as in the example by @jcantwell-JC in the issue mentioned above.I added a method to the resolver which decides if the connection should be an IPC connection, which works well, but I'm not sure if this is the best way to accomplish this.