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))
| 509 | // Deprecated: use WithContextDialer instead. Will be supported throughout |
| 510 | // 1.x. |
| 511 | func 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. |