sync: quic-go 0.42.0

Signed-off-by: Gaukas Wang <i@gaukas.wang>
This commit is contained in:
Gaukas Wang 2024-04-23 22:34:55 -06:00
parent d40dde9b9b
commit 4973374ea5
No known key found for this signature in database
GPG key ID: 6F0DF52D710D8189
252 changed files with 13121 additions and 5437 deletions

View file

@ -20,20 +20,21 @@ type ConnectionTracer struct {
ReceivedLongHeaderPacket func(*ExtendedHeader, ByteCount, ECN, []Frame)
ReceivedShortHeaderPacket func(*ShortHeader, ByteCount, ECN, []Frame)
BufferedPacket func(PacketType, ByteCount)
DroppedPacket func(PacketType, ByteCount, PacketDropReason)
DroppedPacket func(PacketType, PacketNumber, ByteCount, PacketDropReason)
UpdatedMetrics func(rttStats *RTTStats, cwnd, bytesInFlight ByteCount, packetsInFlight int)
AcknowledgedPacket func(EncryptionLevel, PacketNumber)
LostPacket func(EncryptionLevel, PacketNumber, PacketLossReason)
UpdatedCongestionState func(CongestionState)
UpdatedPTOCount func(value uint32)
UpdatedKeyFromTLS func(EncryptionLevel, Perspective)
UpdatedKey func(generation KeyPhase, remote bool)
UpdatedKey func(keyPhase KeyPhase, remote bool)
DroppedEncryptionLevel func(EncryptionLevel)
DroppedKey func(generation KeyPhase)
DroppedKey func(keyPhase KeyPhase)
SetLossTimer func(TimerType, EncryptionLevel, time.Time)
LossTimerExpired func(TimerType, EncryptionLevel)
LossTimerCanceled func()
ECNStateUpdated func(state ECNState, trigger ECNStateTrigger)
ChoseALPN func(protocol string)
// Close is called when the connection is closed.
Close func()
Debug func(name, msg string)
@ -139,10 +140,10 @@ func NewMultiplexedConnectionTracer(tracers ...*ConnectionTracer) *ConnectionTra
}
}
},
DroppedPacket: func(typ PacketType, size ByteCount, reason PacketDropReason) {
DroppedPacket: func(typ PacketType, pn PacketNumber, size ByteCount, reason PacketDropReason) {
for _, t := range tracers {
if t.DroppedPacket != nil {
t.DroppedPacket(typ, size, reason)
t.DroppedPacket(typ, pn, size, reason)
}
}
},
@ -237,6 +238,13 @@ func NewMultiplexedConnectionTracer(tracers ...*ConnectionTracer) *ConnectionTra
}
}
},
ChoseALPN: func(protocol string) {
for _, t := range tracers {
if t.ChoseALPN != nil {
t.ChoseALPN(protocol)
}
}
},
Close: func() {
for _, t := range tracers {
if t.Close != nil {

View file

@ -37,7 +37,7 @@ type (
// The StreamType is the type of the stream (unidirectional or bidirectional).
StreamType = protocol.StreamType
// The VersionNumber is the QUIC version.
VersionNumber = protocol.VersionNumber
VersionNumber = protocol.Version
// The Header is the QUIC packet header, before removing header protection.
Header = wire.Header

View file

@ -64,6 +64,18 @@ var _ = Describe("Tracing", func() {
tr2.EXPECT().DroppedPacket(remote, PacketTypeRetry, ByteCount(1024), PacketDropDuplicate)
tracer.DroppedPacket(remote, PacketTypeRetry, 1024, PacketDropDuplicate)
})
It("traces the Debug event", func() {
tr1.EXPECT().Debug("foo", "bar")
tr2.EXPECT().Debug("foo", "bar")
tracer.Debug("foo", "bar")
})
It("traces the Close event", func() {
tr1.EXPECT().Close()
tr2.EXPECT().Close()
tracer.Close()
})
})
})
@ -93,8 +105,8 @@ var _ = Describe("Tracing", func() {
It("traces the NegotiatedVersion event", func() {
chosen := protocol.Version2
client := []protocol.VersionNumber{protocol.Version1}
server := []protocol.VersionNumber{13, 37}
client := []protocol.Version{protocol.Version1}
server := []protocol.Version{13, 37}
tr1.EXPECT().NegotiatedVersion(chosen, client, server)
tr2.EXPECT().NegotiatedVersion(chosen, client, server)
tracer.NegotiatedVersion(chosen, client, server)
@ -184,9 +196,9 @@ var _ = Describe("Tracing", func() {
})
It("traces the DroppedPacket event", func() {
tr1.EXPECT().DroppedPacket(PacketTypeInitial, ByteCount(1337), PacketDropHeaderParseError)
tr2.EXPECT().DroppedPacket(PacketTypeInitial, ByteCount(1337), PacketDropHeaderParseError)
tracer.DroppedPacket(PacketTypeInitial, 1337, PacketDropHeaderParseError)
tr1.EXPECT().DroppedPacket(PacketTypeInitial, PacketNumber(42), ByteCount(1337), PacketDropHeaderParseError)
tr2.EXPECT().DroppedPacket(PacketTypeInitial, PacketNumber(42), ByteCount(1337), PacketDropHeaderParseError)
tracer.DroppedPacket(PacketTypeInitial, 42, 1337, PacketDropHeaderParseError)
})
It("traces the UpdatedCongestionState event", func() {

View file

@ -7,6 +7,8 @@ type Tracer struct {
SentPacket func(net.Addr, *Header, ByteCount, []Frame)
SentVersionNegotiationPacket func(_ net.Addr, dest, src ArbitraryLenConnectionID, _ []VersionNumber)
DroppedPacket func(net.Addr, PacketType, ByteCount, PacketDropReason)
Debug func(name, msg string)
Close func()
}
// NewMultiplexedTracer creates a new tracer that multiplexes events to multiple tracers.
@ -39,5 +41,19 @@ func NewMultiplexedTracer(tracers ...*Tracer) *Tracer {
}
}
},
Debug: func(name, msg string) {
for _, t := range tracers {
if t.Debug != nil {
t.Debug(name, msg)
}
}
},
Close: func() {
for _, t := range tracers {
if t.Close != nil {
t.Close()
}
}
},
}
}