File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,10 @@ import (
2626)
2727
2828func init () {
29+ x509 .SetFallbackRoots (newFallbackCertPool ())
30+ }
31+
32+ func newFallbackCertPool () * x509.CertPool {
2933 p := x509 .NewCertPool ()
3034 for _ , c := range mustParse (unparsedCertificates ) {
3135 if len (c .constraints ) == 0 {
@@ -41,7 +45,7 @@ func init() {
4145 })
4246 }
4347 }
44- x509 . SetFallbackRoots ( p )
48+ return p
4549}
4650
4751type unparsedCertificate struct {
Original file line number Diff line number Diff line change 1+ package fallback
2+
3+ import "testing"
4+
5+ // BenchmarkInitTime benchmarks the time it takes to parse all certificates
6+ // in this bundle, it corresponds to the init time of this package.
7+ func BenchmarkInitTime (b * testing.B ) {
8+ for range b .N {
9+ newFallbackCertPool ()
10+ }
11+ }
You can’t perform that action at this time.
0 commit comments