From 454a01b2a05ee60388b0f522c204b69c771f169b Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Tue, 21 Aug 2018 15:01:33 +0700 Subject: [PATCH] introduce the IETF QUIC encryption levels --- internal/protocol/encryption_level.go | 16 +++++++++++++++- internal/protocol/encryption_level_test.go | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/internal/protocol/encryption_level.go b/internal/protocol/encryption_level.go index 19480b127..ef001f45c 100644 --- a/internal/protocol/encryption_level.go +++ b/internal/protocol/encryption_level.go @@ -7,22 +7,36 @@ type EncryptionLevel int const ( // EncryptionUnspecified is a not specified encryption level EncryptionUnspecified EncryptionLevel = iota - // EncryptionUnencrypted is not encrypted + // EncryptionUnencrypted is not encrypted, for gQUIC EncryptionUnencrypted + // EncryptionInitial is the Initial encryption level + EncryptionInitial // EncryptionSecure is encrypted, but not forward secure EncryptionSecure + // EncryptionHandshake is the Handshake encryption level + EncryptionHandshake // EncryptionForwardSecure is forward secure EncryptionForwardSecure + // Encryption1RTT is the 1-RTT encryption level + Encryption1RTT ) func (e EncryptionLevel) String() string { switch e { + // gQUIC case EncryptionUnencrypted: return "unencrypted" case EncryptionSecure: return "encrypted (not forward-secure)" case EncryptionForwardSecure: return "forward-secure" + // IETF QUIC + case EncryptionInitial: + return "Initial" + case EncryptionHandshake: + return "Handshake" + case Encryption1RTT: + return "1-RTT" } return "unknown" } diff --git a/internal/protocol/encryption_level_test.go b/internal/protocol/encryption_level_test.go index 12a40d060..79fa45321 100644 --- a/internal/protocol/encryption_level_test.go +++ b/internal/protocol/encryption_level_test.go @@ -11,5 +11,8 @@ var _ = Describe("Encryption Level", func() { Expect(EncryptionUnencrypted.String()).To(Equal("unencrypted")) Expect(EncryptionSecure.String()).To(Equal("encrypted (not forward-secure)")) Expect(EncryptionForwardSecure.String()).To(Equal("forward-secure")) + Expect(EncryptionInitial.String()).To(Equal("Initial")) + Expect(EncryptionHandshake.String()).To(Equal("Handshake")) + Expect(Encryption1RTT.String()).To(Equal("1-RTT")) }) })