@@ -17,6 +17,7 @@ import (
1717 "github.com/redis/go-redis/v9/internal/pool"
1818 "github.com/redis/go-redis/v9/internal/rand"
1919 "github.com/redis/go-redis/v9/push"
20+ "github.com/redis/go-redis/v9/internal/util"
2021)
2122
2223//------------------------------------------------------------------------------
@@ -274,6 +275,7 @@ func (opt *FailoverOptions) clusterOptions() *ClusterOptions {
274275// URL attributes (scheme, host, userinfo, resp.), query parameters using these
275276// names will be treated as unknown parameters
276277// - unknown parameter names will result in an error
278+ // - use "skip_verify=true" to ignore TLS certificate validation
277279//
278280// Example:
279281//
@@ -381,6 +383,10 @@ func setupFailoverConnParams(u *url.URL, o *FailoverOptions) (*FailoverOptions,
381383 o .SentinelAddrs = append (o .SentinelAddrs , net .JoinHostPort (h , p ))
382384 }
383385
386+ if o .TLSConfig != nil && q .has ("skip_verify" ) {
387+ o .TLSConfig .InsecureSkipVerify = q .bool ("skip_verify" )
388+ }
389+
384390 // any parameters left?
385391 if r := q .remaining (); len (r ) > 0 {
386392 return nil , fmt .Errorf ("redis: unexpected option: %s" , strings .Join (r , ", " ))
@@ -806,7 +812,20 @@ func (c *sentinelFailover) MasterAddr(ctx context.Context) (string, error) {
806812 for err := range errCh {
807813 errs = append (errs , err )
808814 }
809- return "" , fmt .Errorf ("redis: all sentinels specified in configuration are unreachable: %w" , errors .Join (errs ... ))
815+ return "" , fmt .Errorf ("redis: all sentinels specified in configuration are unreachable: %s" , joinErrors (errs ))
816+ }
817+
818+ func joinErrors (errs []error ) string {
819+ if len (errs ) == 1 {
820+ return errs [0 ].Error ()
821+ }
822+
823+ b := []byte (errs [0 ].Error ())
824+ for _ , err := range errs [1 :] {
825+ b = append (b , '\n' )
826+ b = append (b , err .Error ()... )
827+ }
828+ return util .BytesToString (b )
810829}
811830
812831func (c * sentinelFailover ) replicaAddrs (ctx context.Context , useDisconnected bool ) ([]string , error ) {
0 commit comments