1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-29 17:41:15 +03:00

Pass network and addr to dialer

This commit is contained in:
Vladimir Mihailenco
2019-05-18 14:00:07 +03:00
parent 90febb9820
commit 3da4357c0c
5 changed files with 24 additions and 11 deletions

View File

@ -3,6 +3,7 @@ package redis
import (
"context"
"crypto/tls"
"net"
"time"
)
@ -19,6 +20,7 @@ type UniversalOptions struct {
// Common options.
Dialer func(network, addr string) (net.Conn, error)
OnConnect func(*Conn) error
Password string
MaxRetries int
@ -54,6 +56,7 @@ func (o *UniversalOptions) cluster() *ClusterOptions {
return &ClusterOptions{
Addrs: o.Addrs,
Dialer: o.Dialer,
OnConnect: o.OnConnect,
Password: o.Password,
@ -89,7 +92,9 @@ func (o *UniversalOptions) failover() *FailoverOptions {
return &FailoverOptions{
SentinelAddrs: o.Addrs,
MasterName: o.MasterName,
OnConnect: o.OnConnect,
Dialer: o.Dialer,
OnConnect: o.OnConnect,
DB: o.DB,
Password: o.Password,
@ -121,6 +126,7 @@ func (o *UniversalOptions) simple() *Options {
return &Options{
Addr: addr,
Dialer: o.Dialer,
OnConnect: o.OnConnect,
DB: o.DB,