go17.go 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. // +build go1.7
  2. package redis
  3. import "crypto/tls"
  4. // similar cloneTLSClientConfig in the stdlib, but also honor skipVerify for the nil case
  5. func cloneTLSClientConfig(cfg *tls.Config, skipVerify bool) *tls.Config {
  6. if cfg == nil {
  7. return &tls.Config{InsecureSkipVerify: skipVerify}
  8. }
  9. return &tls.Config{
  10. Rand: cfg.Rand,
  11. Time: cfg.Time,
  12. Certificates: cfg.Certificates,
  13. NameToCertificate: cfg.NameToCertificate,
  14. GetCertificate: cfg.GetCertificate,
  15. RootCAs: cfg.RootCAs,
  16. NextProtos: cfg.NextProtos,
  17. ServerName: cfg.ServerName,
  18. ClientAuth: cfg.ClientAuth,
  19. ClientCAs: cfg.ClientCAs,
  20. InsecureSkipVerify: cfg.InsecureSkipVerify,
  21. CipherSuites: cfg.CipherSuites,
  22. PreferServerCipherSuites: cfg.PreferServerCipherSuites,
  23. ClientSessionCache: cfg.ClientSessionCache,
  24. MinVersion: cfg.MinVersion,
  25. MaxVersion: cfg.MaxVersion,
  26. CurvePreferences: cfg.CurvePreferences,
  27. DynamicRecordSizingDisabled: cfg.DynamicRecordSizingDisabled,
  28. Renegotiation: cfg.Renegotiation,
  29. }
  30. }