pre_go17.go 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. // Pre Go 1.7 tls.Config deep copy.
  2. // +build !go1.7
  3. package hpkp
  4. import (
  5. "crypto/tls"
  6. )
  7. func cloneTLSConfig(cfg *tls.Config) *tls.Config {
  8. return &tls.Config{
  9. Rand: cfg.Rand,
  10. Time: cfg.Time,
  11. Certificates: cfg.Certificates,
  12. NameToCertificate: cfg.NameToCertificate,
  13. GetCertificate: cfg.GetCertificate,
  14. RootCAs: cfg.RootCAs,
  15. NextProtos: cfg.NextProtos,
  16. ServerName: cfg.ServerName,
  17. ClientAuth: cfg.ClientAuth,
  18. ClientCAs: cfg.ClientCAs,
  19. InsecureSkipVerify: cfg.InsecureSkipVerify,
  20. CipherSuites: cfg.CipherSuites,
  21. PreferServerCipherSuites: cfg.PreferServerCipherSuites,
  22. SessionTicketsDisabled: cfg.SessionTicketsDisabled,
  23. SessionTicketKey: cfg.SessionTicketKey,
  24. ClientSessionCache: cfg.ClientSessionCache,
  25. MinVersion: cfg.MinVersion,
  26. MaxVersion: cfg.MaxVersion,
  27. CurvePreferences: cfg.CurvePreferences,
  28. }
  29. }