mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-18 07:17:32 -05:00
benchmark certificate issuing
This commit is contained in:
parent
e99dd29946
commit
d2d0c69f17
@ -73,3 +73,27 @@ func TestInsecureCertificates(t *testing.T) {
|
|||||||
t.Fatal("Unexpected tls cipher suites list: ", tlsConfig.CipherSuites)
|
t.Fatal("Unexpected tls cipher suites list: ", tlsConfig.CipherSuites)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func BenchmarkCertificateIssuing(b *testing.B) {
|
||||||
|
certificate := ParseCertificate(cert.MustGenerate(nil, cert.Authority(true), cert.KeyUsage(x509.KeyUsageCertSign)))
|
||||||
|
certificate.Usage = Certificate_AUTHORITY_ISSUE
|
||||||
|
|
||||||
|
c := &Config{
|
||||||
|
Certificate: []*Certificate{
|
||||||
|
certificate,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
tlsConfig := c.GetTLSConfig()
|
||||||
|
lenCerts := len(tlsConfig.Certificates)
|
||||||
|
|
||||||
|
b.ResetTimer()
|
||||||
|
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
_, _ = tlsConfig.GetCertificate(&gotls.ClientHelloInfo{
|
||||||
|
ServerName: "www.v2ray.com",
|
||||||
|
})
|
||||||
|
delete(tlsConfig.NameToCertificate, "www.v2ray.com")
|
||||||
|
tlsConfig.Certificates = tlsConfig.Certificates[:lenCerts]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user