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

@ -25,6 +25,7 @@ type FailoverOptions struct {
// Following options are copied from Options struct.
Dialer func(network, addr string) (net.Conn, error)
OnConnect func(*Conn) error
Password string
@ -50,8 +51,8 @@ type FailoverOptions struct {
func (opt *FailoverOptions) options() *Options {
return &Options{
Addr: "FailoverClient",
Addr: "FailoverClient",
Dialer: opt.Dialer,
OnConnect: opt.OnConnect,
DB: opt.DB,
@ -304,7 +305,7 @@ func (c *sentinelFailover) Pool() *pool.ConnPool {
return c.pool
}
func (c *sentinelFailover) dial() (net.Conn, error) {
func (c *sentinelFailover) dial(network, addr string) (net.Conn, error) {
addr, err := c.MasterAddr()
if err != nil {
return nil, err