MCPcopy
hub / github.com/redis/go-redis / NewDialer

Function NewDialer

options.go:447–458  ·  view source on GitHub ↗

NewDialer returns a function that will be used as the default dialer when none is specified in Options.Dialer.

(opt *Options)

Source from the content-addressed store, hash-verified

445// NewDialer returns a function that will be used as the default dialer
446// when none is specified in Options.Dialer.
447func NewDialer(opt *Options) func(context.Context, string, string) (net.Conn, error) {
448 return func(ctx context.Context, network, addr string) (net.Conn, error) {
449 netDialer := &net.Dialer{
450 Timeout: opt.DialTimeout,
451 KeepAlive: 5 * time.Minute,
452 }
453 if opt.TLSConfig == nil {
454 return netDialer.DialContext(ctx, network, addr)
455 }
456 return tls.DialWithDialer(netDialer, network, addr, opt.TLSConfig)
457 }
458}
459
460// ParseURL parses a URL into Options that can be used to connect to Redis.
461// Scheme is required.

Callers 2

initMethod · 0.85
NewDialerMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected