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:
@ -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,
|
||||
|
Reference in New Issue
Block a user