forked from quic-go/quic-go
introduce the IETF QUIC encryption levels
This commit is contained in:
@@ -7,22 +7,36 @@ type EncryptionLevel int
|
|||||||
const (
|
const (
|
||||||
// EncryptionUnspecified is a not specified encryption level
|
// EncryptionUnspecified is a not specified encryption level
|
||||||
EncryptionUnspecified EncryptionLevel = iota
|
EncryptionUnspecified EncryptionLevel = iota
|
||||||
// EncryptionUnencrypted is not encrypted
|
// EncryptionUnencrypted is not encrypted, for gQUIC
|
||||||
EncryptionUnencrypted
|
EncryptionUnencrypted
|
||||||
|
// EncryptionInitial is the Initial encryption level
|
||||||
|
EncryptionInitial
|
||||||
// EncryptionSecure is encrypted, but not forward secure
|
// EncryptionSecure is encrypted, but not forward secure
|
||||||
EncryptionSecure
|
EncryptionSecure
|
||||||
|
// EncryptionHandshake is the Handshake encryption level
|
||||||
|
EncryptionHandshake
|
||||||
// EncryptionForwardSecure is forward secure
|
// EncryptionForwardSecure is forward secure
|
||||||
EncryptionForwardSecure
|
EncryptionForwardSecure
|
||||||
|
// Encryption1RTT is the 1-RTT encryption level
|
||||||
|
Encryption1RTT
|
||||||
)
|
)
|
||||||
|
|
||||||
func (e EncryptionLevel) String() string {
|
func (e EncryptionLevel) String() string {
|
||||||
switch e {
|
switch e {
|
||||||
|
// gQUIC
|
||||||
case EncryptionUnencrypted:
|
case EncryptionUnencrypted:
|
||||||
return "unencrypted"
|
return "unencrypted"
|
||||||
case EncryptionSecure:
|
case EncryptionSecure:
|
||||||
return "encrypted (not forward-secure)"
|
return "encrypted (not forward-secure)"
|
||||||
case EncryptionForwardSecure:
|
case EncryptionForwardSecure:
|
||||||
return "forward-secure"
|
return "forward-secure"
|
||||||
|
// IETF QUIC
|
||||||
|
case EncryptionInitial:
|
||||||
|
return "Initial"
|
||||||
|
case EncryptionHandshake:
|
||||||
|
return "Handshake"
|
||||||
|
case Encryption1RTT:
|
||||||
|
return "1-RTT"
|
||||||
}
|
}
|
||||||
return "unknown"
|
return "unknown"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,5 +11,8 @@ var _ = Describe("Encryption Level", func() {
|
|||||||
Expect(EncryptionUnencrypted.String()).To(Equal("unencrypted"))
|
Expect(EncryptionUnencrypted.String()).To(Equal("unencrypted"))
|
||||||
Expect(EncryptionSecure.String()).To(Equal("encrypted (not forward-secure)"))
|
Expect(EncryptionSecure.String()).To(Equal("encrypted (not forward-secure)"))
|
||||||
Expect(EncryptionForwardSecure.String()).To(Equal("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"))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user