MCPcopy
hub / github.com/grpc/grpc-go / WithDialer

Function WithDialer

dialoptions.go:511–519  ·  view source on GitHub ↗

WithDialer returns a DialOption that specifies a function to use for dialing network addresses. If FailOnNonTempDialError() is set to true, and an error is returned by f, gRPC checks the error's Temporary() method to decide if it should try to reconnect to the network address. Deprecated: use WithC

(f func(string, time.Duration) (net.Conn, error))

Source from the content-addressed store, hash-verified

509// Deprecated: use WithContextDialer instead. Will be supported throughout
510// 1.x.
511func WithDialer(f func(string, time.Duration) (net.Conn, error)) DialOption {
512 return WithContextDialer(
513 func(ctx context.Context, addr string) (net.Conn, error) {
514 if deadline, ok := ctx.Deadline(); ok {
515 return f(addr, time.Until(deadline))
516 }
517 return f(addr, 0)
518 })
519}
520
521// WithStatsHandler returns a DialOption that specifies the stats handler for
522// all the RPCs and underlying network connections in this ClientConn.

Callers 8

configDialMethod · 0.92
TestNetPipeConnMethod · 0.92
testLocalCredsE2EFailFunction · 0.92
TestBackoffCancelMethod · 0.85

Calls 1

WithContextDialerFunction · 0.85

Tested by 8

configDialMethod · 0.74
TestNetPipeConnMethod · 0.74
testLocalCredsE2EFailFunction · 0.74
TestBackoffCancelMethod · 0.68