-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
support unix domain socket #169
Conversation
@@ -95,6 +96,14 @@ func WithTimeout(d time.Duration) DialOption { | |||
} | |||
} | |||
|
|||
// WithNetwork returns a DialOption that specifies the network on which | |||
// the connection will be established. | |||
func WithNetwork(network string) DialOption { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels too specific. It doesn't help this support any other address types either. Why don't we simply accept a dialer option that takes complete responsibility for turning the address into a net.Conn?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Fri, Apr 17, 2015 at 3:44 PM, David Symonds notifications@github.com
wrote:
In clientconn.go
#169 (comment):@@ -95,6 +96,14 @@ func WithTimeout(d time.Duration) DialOption {
}
}+// WithNetwork returns a DialOption that specifies the network on which
+// the connection will be established.
+func WithNetwork(network string) DialOption {This feels too specific. It doesn't help this support any other address
types either. Why don't we simply accept a dialer option that takes
complete responsibility for turning the address into a net.Conn?I do not get it. Can you elaborate? What is "a dialer option"? Are you
proposing to have our own struct to take complete responsibility for
turning the addr to a net.Conn?—
Reply to this email directly or view it on GitHub
https://github.com/grpc/grpc-go/pull/169/files#r28635771.
I mean, instead of a func WithDialer(f func(addr string) (net.Conn, error)) DialOption and then use that function in place of net.Dial (or as the dialer passed to tls.Dial). |
On Fri, Apr 17, 2015 at 4:02 PM, David Symonds notifications@github.com
When you said "It doesn't help this support any other address types —
|
If you're wanting to dial UDS, it's all of one line to do the dial (invoke There's lots of other dialing requirements, like Google-internal things, or dialing on App Engine (e.g. you need to use the socket API there), or wanting to monitor/control/log outbound connection information, and so on. |
The problem/difficulty to take this approach is that it has to merge with https://github.com/grpc/grpc-go/blob/master/transport/http2_client.go#L118 and https://github.com/grpc/grpc-go/blob/master/transport/http2_client.go#L113 If we merge them, again it seems it complicates the task if a user only On Fri, Apr 17, 2015 at 4:23 PM, David Symonds notifications@github.com
|
That the code is already a bit weird in trying to handle timeouts is unfortunate, and should itself probably be fixed. I flagged that previously, but didn't have the time to pursue it. I wasn't suggesting getting rid of A timeout is really the only option to the dialer that makes sense across almost every dialer, so it seems reasonable to make the signature be |
On Fri, Apr 17, 2015 at 11:29 PM, David Symonds notifications@github.com
I had some discussion with java and c grpc teams. They plan to do / is
|
My latest suggested WithDialer should be passed a timeout, which would be set from WithTimeout. So they work together fine. It's then up to the dialer to use that timeout appropriately. grpc.Dial can use the tls package directly, and tell it to use a dialer, which would be a closure invoking whatever is passed in via WithDialer. The current code already does something vaguely along these lines; my proposal only slightly generalises it. |
On Mon, Apr 20, 2015 at 9:43 PM, David Symonds notifications@github.com
|
You don't have to use tls.DialWithDialer. It's a helper if you have a net.Dialer. You can use tls.Client and tls.Handshake over an existing net.Conn. That's only a few lines of code. |
On Mon, Apr 20, 2015 at 10:22 PM, David Symonds notifications@github.com
|
Sorry, yes, I didn't read your previous email. Yes, your plan seems fine.
You can see the App Engine dialing reference doc at
https://cloud.google.com/appengine/docs/go/sockets/reference. A dialer to
use that would need to curry in the appengine.Context arg, but otherwise it
is trivial to do if you can support the WithDialer option.
|
No description provided.