qlog the packet_type as part of the packet header, not the event itself

This commit is contained in:
Marten Seemann 2020-09-08 09:43:17 +07:00
parent 5a0ce24265
commit 4f557317a0
5 changed files with 19 additions and 18 deletions

View file

@ -1,10 +1,11 @@
package qlog
import (
"github.com/francoispqt/gojay"
"github.com/lucas-clemente/quic-go/internal/protocol"
"github.com/lucas-clemente/quic-go/internal/wire"
"github.com/lucas-clemente/quic-go/logging"
"github.com/francoispqt/gojay"
)
func getPacketTypeFromEncryptionLevel(encLevel protocol.EncryptionLevel) packetType {
@ -59,6 +60,7 @@ func transformExtendedHeader(hdr *wire.ExtendedHeader) *packetHeader {
}
func (h packetHeader) MarshalJSONObject(enc *gojay.Encoder) {
enc.StringKey("packet_type", packetType(h.PacketType).String())
if h.PacketType != logging.PacketTypeRetry && h.PacketType != logging.PacketTypeVersionNegotiation {
enc.Int64Key("packet_number", int64(h.PacketNumber))
}