fill out the http.Response.TLS field

This commit is contained in:
Marten Seemann
2020-10-29 15:29:43 +07:00
parent 2839cbdcff
commit 30c91149c2
4 changed files with 35 additions and 0 deletions

View File

@@ -143,6 +143,25 @@ func GetConnectionState(conn *Conn) ConnectionState {
return conn.ConnectionState()
}
// ToTLSConnectionState extracts the tls.ConnectionState
// Warning: Calling ExportKeyingMaterial won't work.
func ToTLSConnectionState(cs ConnectionState) tls.ConnectionState {
return tls.ConnectionState{
Version: cs.Version,
HandshakeComplete: cs.HandshakeComplete,
DidResume: cs.DidResume,
CipherSuite: cs.CipherSuite,
NegotiatedProtocol: cs.NegotiatedProtocol,
NegotiatedProtocolIsMutual: cs.NegotiatedProtocolIsMutual,
ServerName: cs.ServerName,
PeerCertificates: cs.PeerCertificates,
VerifiedChains: cs.VerifiedChains,
SignedCertificateTimestamps: cs.SignedCertificateTimestamps,
OCSPResponse: cs.OCSPResponse,
TLSUnique: cs.TLSUnique,
}
}
type cipherSuiteTLS13 struct {
ID uint16
KeyLen int