go17.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Go 1.7 tls.Config deep copy.
  2. // +build go1.7,!go1.8
  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. DynamicRecordSizingDisabled: cfg.DynamicRecordSizingDisabled,
  29. Renegotiation: cfg.Renegotiation,
  30. }
  31. }