forked from quic-go/quic-go
log the encryption level of sent and received packets
This commit is contained in:
@@ -14,3 +14,15 @@ const (
|
||||
// EncryptionForwardSecure is forward secure
|
||||
EncryptionForwardSecure
|
||||
)
|
||||
|
||||
func (e EncryptionLevel) String() string {
|
||||
switch e {
|
||||
case EncryptionUnencrypted:
|
||||
return "unencrypted"
|
||||
case EncryptionSecure:
|
||||
return "encrypted (not forward-secure)"
|
||||
case EncryptionForwardSecure:
|
||||
return "forward-secure"
|
||||
}
|
||||
return "unknown"
|
||||
}
|
||||
|
||||
15
protocol/encryption_level_test.go
Normal file
15
protocol/encryption_level_test.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package protocol
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("Encryption Level", func() {
|
||||
It("has the correct string representation", func() {
|
||||
Expect(EncryptionUnspecified.String()).To(Equal("unknown"))
|
||||
Expect(EncryptionUnencrypted.String()).To(Equal("unencrypted"))
|
||||
Expect(EncryptionSecure.String()).To(Equal("encrypted (not forward-secure)"))
|
||||
Expect(EncryptionForwardSecure.String()).To(Equal("forward-secure"))
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user