diff --git a/cluster.go b/cluster.go index 4a295115..4f5f5b55 100644 --- a/cluster.go +++ b/cluster.go @@ -2,6 +2,7 @@ package redis import ( "context" + "crypto/tls" "errors" "fmt" "math" @@ -56,6 +57,8 @@ type ClusterOptions struct { PoolTimeout time.Duration IdleTimeout time.Duration IdleCheckFrequency time.Duration + + TLSConfig *tls.Config } func (opt *ClusterOptions) init() { @@ -117,6 +120,8 @@ func (opt *ClusterOptions) clientOptions() *Options { IdleTimeout: opt.IdleTimeout, IdleCheckFrequency: disableIdleCheck, + + TLSConfig: opt.TLSConfig, } } diff --git a/sentinel.go b/sentinel.go index 3f56f08b..64248a52 100644 --- a/sentinel.go +++ b/sentinel.go @@ -1,6 +1,7 @@ package redis import ( + "crypto/tls" "errors" "net" "strings" @@ -38,6 +39,8 @@ type FailoverOptions struct { PoolTimeout time.Duration IdleTimeout time.Duration IdleCheckFrequency time.Duration + + TLSConfig *tls.Config } func (opt *FailoverOptions) options() *Options { @@ -59,6 +62,8 @@ func (opt *FailoverOptions) options() *Options { PoolTimeout: opt.PoolTimeout, IdleTimeout: opt.IdleTimeout, IdleCheckFrequency: opt.IdleCheckFrequency, + + TLSConfig: opt.TLSConfig, } } diff --git a/universal.go b/universal.go index 5838d7a5..9e30c81d 100644 --- a/universal.go +++ b/universal.go @@ -1,6 +1,9 @@ package redis -import "time" +import ( + "crypto/tls" + "time" +) // UniversalOptions information is required by UniversalClient to establish // connections. @@ -37,6 +40,7 @@ type UniversalOptions struct { PoolTimeout time.Duration IdleTimeout time.Duration IdleCheckFrequency time.Duration + TLSConfig *tls.Config } func (o *UniversalOptions) cluster() *ClusterOptions { @@ -60,6 +64,7 @@ func (o *UniversalOptions) cluster() *ClusterOptions { PoolTimeout: o.PoolTimeout, IdleTimeout: o.IdleTimeout, IdleCheckFrequency: o.IdleCheckFrequency, + TLSConfig: o.TLSConfig, } } @@ -83,6 +88,7 @@ func (o *UniversalOptions) failover() *FailoverOptions { PoolTimeout: o.PoolTimeout, IdleTimeout: o.IdleTimeout, IdleCheckFrequency: o.IdleCheckFrequency, + TLSConfig: o.TLSConfig, } } @@ -106,6 +112,7 @@ func (o *UniversalOptions) simple() *Options { PoolTimeout: o.PoolTimeout, IdleTimeout: o.IdleTimeout, IdleCheckFrequency: o.IdleCheckFrequency, + TLSConfig: o.TLSConfig, } }