@@ -16,6 +16,7 @@ import (
1616 "github.com/redis/go-redis/v9/internal"
1717 "github.com/redis/go-redis/v9/internal/pool"
1818 "github.com/redis/go-redis/v9/internal/rand"
19+ "github.com/redis/go-redis/v9/internal/util"
1920)
2021
2122//------------------------------------------------------------------------------
@@ -271,6 +272,7 @@ func (opt *FailoverOptions) clusterOptions() *ClusterOptions {
271272// URL attributes (scheme, host, userinfo, resp.), query parameters using these
272273// names will be treated as unknown parameters
273274// - unknown parameter names will result in an error
275+ // - use "skip_verify=true" to ignore TLS certificate validation
274276//
275277// Example:
276278//
@@ -378,6 +380,10 @@ func setupFailoverConnParams(u *url.URL, o *FailoverOptions) (*FailoverOptions,
378380 o .SentinelAddrs = append (o .SentinelAddrs , net .JoinHostPort (h , p ))
379381 }
380382
383+ if o .TLSConfig != nil && q .has ("skip_verify" ) {
384+ o .TLSConfig .InsecureSkipVerify = q .bool ("skip_verify" )
385+ }
386+
381387 // any parameters left?
382388 if r := q .remaining (); len (r ) > 0 {
383389 return nil , fmt .Errorf ("redis: unexpected option: %s" , strings .Join (r , ", " ))
@@ -782,7 +788,20 @@ func (c *sentinelFailover) MasterAddr(ctx context.Context) (string, error) {
782788 for err := range errCh {
783789 errs = append (errs , err )
784790 }
785- return "" , fmt .Errorf ("redis: all sentinels specified in configuration are unreachable: %w" , errors .Join (errs ... ))
791+ return "" , fmt .Errorf ("redis: all sentinels specified in configuration are unreachable: %s" , joinErrors (errs ))
792+ }
793+
794+ func joinErrors (errs []error ) string {
795+ if len (errs ) == 1 {
796+ return errs [0 ].Error ()
797+ }
798+
799+ b := []byte (errs [0 ].Error ())
800+ for _ , err := range errs [1 :] {
801+ b = append (b , '\n' )
802+ b = append (b , err .Error ()... )
803+ }
804+ return util .BytesToString (b )
786805}
787806
788807func (c * sentinelFailover ) replicaAddrs (ctx context.Context , useDisconnected bool ) ([]string , error ) {
0 commit comments