Browse Source

Use `Config.Clone()` for the deep copy where available.

Yawning Angel 3 years ago
parent
commit
30623e5213
2 changed files with 15 additions and 2 deletions
  1. 2 2
      go17.go
  2. 13 0
      go18.go

+ 2 - 2
go17.go

@@ -1,6 +1,6 @@
-// Go 1.7 and later tls.Config deep copy.
+// Go 1.7 tls.Config deep copy.
 
-// +build go1.7
+// +build go1.7,!go1.8
 
 package hpkp
 

+ 13 - 0
go18.go

@@ -0,0 +1,13 @@
+// Go 1.8 and later tls.Config deep copy.
+
+// +build go1.8
+
+package hpkp
+
+import (
+	"crypto/tls"
+)
+
+func cloneTLSConfig(cfg *tls.Config) *tls.Config {
+	return cfg.Clone()
+}