return the encryption level of a packet when decrypting it

This commit is contained in:
Marten Seemann
2017-02-24 13:01:17 +07:00
parent 811bd20939
commit a972c7a21e
12 changed files with 85 additions and 47 deletions

View File

@@ -45,9 +45,10 @@ var _ h2quicClient = &Client{}
// NewClient creates a new client
func NewClient(t *QuicRoundTripper, tlsConfig *tls.Config, hostname string) *Client {
c := &Client{
t: t,
hostname: authorityAddr("https", hostname),
responses: make(map[protocol.StreamID]chan *http.Response),
t: t,
hostname: authorityAddr("https", hostname),
responses: make(map[protocol.StreamID]chan *http.Response),
encryptionLevel: protocol.EncryptionUnencrypted,
}
c.cryptoChangedCond = sync.Cond{L: &c.mutex}
c.config = &quic.Config{

View File

@@ -90,7 +90,7 @@ var _ = Describe("Client", func() {
})
It("sets the correct crypto level", func() {
Expect(client.encryptionLevel).To(Equal(protocol.Unencrypted))
Expect(client.encryptionLevel).To(Equal(protocol.EncryptionUnencrypted))
client.config.ConnState(session, quic.ConnStateSecure)
Expect(client.encryptionLevel).To(Equal(protocol.EncryptionSecure))
client.config.ConnState(session, quic.ConnStateForwardSecure)