rename the logging.Tracer to ConnectionTracer

This commit is contained in:
Marten Seemann 2020-06-29 12:22:58 +07:00
parent 7f6eca84da
commit 4121ea84f4
15 changed files with 154 additions and 154 deletions

View file

@ -41,7 +41,7 @@ type client struct {
session quicSession session quicSession
tracer logging.Tracer tracer logging.ConnectionTracer
logger utils.Logger logger utils.Logger
} }

View file

@ -34,7 +34,7 @@ var _ = Describe("Client", func() {
mockMultiplexer *MockMultiplexer mockMultiplexer *MockMultiplexer
origMultiplexer multiplexer origMultiplexer multiplexer
tlsConf *tls.Config tlsConf *tls.Config
tracer *mocks.MockTracer tracer *mocks.MockConnectionTracer
config *Config config *Config
originalClientSessConstructor func( originalClientSessConstructor func(
@ -48,11 +48,11 @@ var _ = Describe("Client", func() {
initialVersion protocol.VersionNumber, initialVersion protocol.VersionNumber,
enable0RTT bool, enable0RTT bool,
hasNegotiatedVersion bool, hasNegotiatedVersion bool,
tracer logging.Tracer, tracer logging.ConnectionTracer,
logger utils.Logger, logger utils.Logger,
v protocol.VersionNumber, v protocol.VersionNumber,
) quicSession ) quicSession
originalTracerConstructor func(io.WriteCloser, protocol.Perspective, protocol.ConnectionID) logging.Tracer originalTracerConstructor func(io.WriteCloser, protocol.Perspective, protocol.ConnectionID) logging.ConnectionTracer
) )
// generate a packet sent by the server that accepts the QUIC version suggested by the client // generate a packet sent by the server that accepts the QUIC version suggested by the client
@ -71,8 +71,8 @@ var _ = Describe("Client", func() {
connID = protocol.ConnectionID{0, 0, 0, 0, 0, 0, 0x13, 0x37} connID = protocol.ConnectionID{0, 0, 0, 0, 0, 0, 0x13, 0x37}
originalClientSessConstructor = newClientSession originalClientSessConstructor = newClientSession
originalTracerConstructor = newTracer originalTracerConstructor = newTracer
tracer = mocks.NewMockTracer(mockCtrl) tracer = mocks.NewMockConnectionTracer(mockCtrl)
newTracer = func(io.WriteCloser, protocol.Perspective, protocol.ConnectionID) logging.Tracer { newTracer = func(io.WriteCloser, protocol.Perspective, protocol.ConnectionID) logging.ConnectionTracer {
return tracer return tracer
} }
config = &Config{ config = &Config{
@ -161,7 +161,7 @@ var _ = Describe("Client", func() {
_ protocol.VersionNumber, _ protocol.VersionNumber,
_ bool, _ bool,
_ bool, _ bool,
_ logging.Tracer, _ logging.ConnectionTracer,
_ utils.Logger, _ utils.Logger,
_ protocol.VersionNumber, _ protocol.VersionNumber,
) quicSession { ) quicSession {
@ -194,7 +194,7 @@ var _ = Describe("Client", func() {
_ protocol.VersionNumber, _ protocol.VersionNumber,
_ bool, _ bool,
_ bool, _ bool,
_ logging.Tracer, _ logging.ConnectionTracer,
_ utils.Logger, _ utils.Logger,
_ protocol.VersionNumber, _ protocol.VersionNumber,
) quicSession { ) quicSession {
@ -227,7 +227,7 @@ var _ = Describe("Client", func() {
_ protocol.VersionNumber, _ protocol.VersionNumber,
_ bool, _ bool,
_ bool, _ bool,
_ logging.Tracer, _ logging.ConnectionTracer,
_ utils.Logger, _ utils.Logger,
_ protocol.VersionNumber, _ protocol.VersionNumber,
) quicSession { ) quicSession {
@ -266,7 +266,7 @@ var _ = Describe("Client", func() {
_ protocol.VersionNumber, _ protocol.VersionNumber,
enable0RTT bool, enable0RTT bool,
_ bool, _ bool,
_ logging.Tracer, _ logging.ConnectionTracer,
_ utils.Logger, _ utils.Logger,
_ protocol.VersionNumber, _ protocol.VersionNumber,
) quicSession { ) quicSession {
@ -309,7 +309,7 @@ var _ = Describe("Client", func() {
_ protocol.VersionNumber, _ protocol.VersionNumber,
enable0RTT bool, enable0RTT bool,
_ bool, _ bool,
_ logging.Tracer, _ logging.ConnectionTracer,
_ utils.Logger, _ utils.Logger,
_ protocol.VersionNumber, _ protocol.VersionNumber,
) quicSession { ) quicSession {
@ -357,7 +357,7 @@ var _ = Describe("Client", func() {
_ protocol.VersionNumber, _ protocol.VersionNumber,
_ bool, _ bool,
_ bool, _ bool,
_ logging.Tracer, _ logging.ConnectionTracer,
_ utils.Logger, _ utils.Logger,
_ protocol.VersionNumber, _ protocol.VersionNumber,
) quicSession { ) quicSession {
@ -401,7 +401,7 @@ var _ = Describe("Client", func() {
_ protocol.VersionNumber, _ protocol.VersionNumber,
_ bool, _ bool,
_ bool, _ bool,
_ logging.Tracer, _ logging.ConnectionTracer,
_ utils.Logger, _ utils.Logger,
_ protocol.VersionNumber, _ protocol.VersionNumber,
) quicSession { ) quicSession {
@ -453,7 +453,7 @@ var _ = Describe("Client", func() {
_ protocol.VersionNumber, _ protocol.VersionNumber,
_ bool, _ bool,
_ bool, _ bool,
_ logging.Tracer, _ logging.ConnectionTracer,
_ utils.Logger, _ utils.Logger,
_ protocol.VersionNumber, _ protocol.VersionNumber,
) quicSession { ) quicSession {
@ -574,7 +574,7 @@ var _ = Describe("Client", func() {
_ protocol.VersionNumber, /* initial version */ _ protocol.VersionNumber, /* initial version */
_ bool, _ bool,
_ bool, _ bool,
_ logging.Tracer, _ logging.ConnectionTracer,
_ utils.Logger, _ utils.Logger,
versionP protocol.VersionNumber, versionP protocol.VersionNumber,
) quicSession { ) quicSession {
@ -616,7 +616,7 @@ var _ = Describe("Client", func() {
version protocol.VersionNumber, version protocol.VersionNumber,
_ bool, _ bool,
hasNegotiatedVersion bool, hasNegotiatedVersion bool,
_ logging.Tracer, _ logging.ConnectionTracer,
_ utils.Logger, _ utils.Logger,
versionP protocol.VersionNumber, versionP protocol.VersionNumber,
) quicSession { ) quicSession {

View file

@ -14,7 +14,7 @@ func NewAckHandler(
rttStats *congestion.RTTStats, rttStats *congestion.RTTStats,
pers protocol.Perspective, pers protocol.Perspective,
traceCallback func(quictrace.Event), traceCallback func(quictrace.Event),
tracer logging.Tracer, tracer logging.ConnectionTracer,
logger utils.Logger, logger utils.Logger,
version protocol.VersionNumber, version protocol.VersionNumber,
) (SentPacketHandler, ReceivedPacketHandler) { ) (SentPacketHandler, ReceivedPacketHandler) {

View file

@ -84,7 +84,7 @@ type sentPacketHandler struct {
perspective protocol.Perspective perspective protocol.Perspective
traceCallback func(quictrace.Event) traceCallback func(quictrace.Event)
tracer logging.Tracer tracer logging.ConnectionTracer
logger utils.Logger logger utils.Logger
} }
@ -96,7 +96,7 @@ func newSentPacketHandler(
rttStats *congestion.RTTStats, rttStats *congestion.RTTStats,
pers protocol.Perspective, pers protocol.Perspective,
traceCallback func(quictrace.Event), traceCallback func(quictrace.Event),
tracer logging.Tracer, tracer logging.ConnectionTracer,
logger utils.Logger, logger utils.Logger,
) *sentPacketHandler { ) *sentPacketHandler {
congestion := congestion.NewCubicSender( congestion := congestion.NewCubicSender(

View file

@ -94,7 +94,7 @@ type cryptoSetup struct {
rttStats *congestion.RTTStats rttStats *congestion.RTTStats
tracer logging.Tracer tracer logging.ConnectionTracer
logger utils.Logger logger utils.Logger
perspective protocol.Perspective perspective protocol.Perspective
@ -137,7 +137,7 @@ func NewCryptoSetupClient(
tlsConf *tls.Config, tlsConf *tls.Config,
enable0RTT bool, enable0RTT bool,
rttStats *congestion.RTTStats, rttStats *congestion.RTTStats,
tracer logging.Tracer, tracer logging.ConnectionTracer,
logger utils.Logger, logger utils.Logger,
) (CryptoSetup, <-chan *wire.TransportParameters /* ClientHello written. Receive nil for non-0-RTT */) { ) (CryptoSetup, <-chan *wire.TransportParameters /* ClientHello written. Receive nil for non-0-RTT */) {
cs, clientHelloWritten := newCryptoSetup( cs, clientHelloWritten := newCryptoSetup(
@ -169,7 +169,7 @@ func NewCryptoSetupServer(
tlsConf *tls.Config, tlsConf *tls.Config,
enable0RTT bool, enable0RTT bool,
rttStats *congestion.RTTStats, rttStats *congestion.RTTStats,
tracer logging.Tracer, tracer logging.ConnectionTracer,
logger utils.Logger, logger utils.Logger,
) CryptoSetup { ) CryptoSetup {
cs, _ := newCryptoSetup( cs, _ := newCryptoSetup(
@ -198,7 +198,7 @@ func newCryptoSetup(
tlsConf *tls.Config, tlsConf *tls.Config,
enable0RTT bool, enable0RTT bool,
rttStats *congestion.RTTStats, rttStats *congestion.RTTStats,
tracer logging.Tracer, tracer logging.ConnectionTracer,
logger utils.Logger, logger utils.Logger,
perspective protocol.Perspective, perspective protocol.Perspective,
) (*cryptoSetup, <-chan *wire.TransportParameters /* ClientHello written. Receive nil for non-0-RTT */) { ) (*cryptoSetup, <-chan *wire.TransportParameters /* ClientHello written. Receive nil for non-0-RTT */) {

View file

@ -74,7 +74,7 @@ type updatableAEAD struct {
rttStats *congestion.RTTStats rttStats *congestion.RTTStats
tracer logging.Tracer tracer logging.ConnectionTracer
logger utils.Logger logger utils.Logger
// use a single slice to avoid allocations // use a single slice to avoid allocations
@ -84,7 +84,7 @@ type updatableAEAD struct {
var _ ShortHeaderOpener = &updatableAEAD{} var _ ShortHeaderOpener = &updatableAEAD{}
var _ ShortHeaderSealer = &updatableAEAD{} var _ ShortHeaderSealer = &updatableAEAD{}
func newUpdatableAEAD(rttStats *congestion.RTTStats, tracer logging.Tracer, logger utils.Logger) *updatableAEAD { func newUpdatableAEAD(rttStats *congestion.RTTStats, tracer logging.ConnectionTracer, logger utils.Logger) *updatableAEAD {
return &updatableAEAD{ return &updatableAEAD{
firstPacketNumber: protocol.InvalidPacketNumber, firstPacketNumber: protocol.InvalidPacketNumber,
largestAcked: protocol.InvalidPacketNumber, largestAcked: protocol.InvalidPacketNumber,

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT. // Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go/logging (interfaces: Tracer) // Source: github.com/lucas-clemente/quic-go/logging (interfaces: ConnectionTracer)
// Package mocks is a generated GoMock package. // Package mocks is a generated GoMock package.
package mocks package mocks
@ -16,277 +16,277 @@ import (
logging "github.com/lucas-clemente/quic-go/logging" logging "github.com/lucas-clemente/quic-go/logging"
) )
// MockTracer is a mock of Tracer interface // MockConnectionTracer is a mock of ConnectionTracer interface
type MockTracer struct { type MockConnectionTracer struct {
ctrl *gomock.Controller ctrl *gomock.Controller
recorder *MockTracerMockRecorder recorder *MockConnectionTracerMockRecorder
} }
// MockTracerMockRecorder is the mock recorder for MockTracer // MockConnectionTracerMockRecorder is the mock recorder for MockConnectionTracer
type MockTracerMockRecorder struct { type MockConnectionTracerMockRecorder struct {
mock *MockTracer mock *MockConnectionTracer
} }
// NewMockTracer creates a new mock instance // NewMockConnectionTracer creates a new mock instance
func NewMockTracer(ctrl *gomock.Controller) *MockTracer { func NewMockConnectionTracer(ctrl *gomock.Controller) *MockConnectionTracer {
mock := &MockTracer{ctrl: ctrl} mock := &MockConnectionTracer{ctrl: ctrl}
mock.recorder = &MockTracerMockRecorder{mock} mock.recorder = &MockConnectionTracerMockRecorder{mock}
return mock return mock
} }
// EXPECT returns an object that allows the caller to indicate expected use // EXPECT returns an object that allows the caller to indicate expected use
func (m *MockTracer) EXPECT() *MockTracerMockRecorder { func (m *MockConnectionTracer) EXPECT() *MockConnectionTracerMockRecorder {
return m.recorder return m.recorder
} }
// BufferedPacket mocks base method // BufferedPacket mocks base method
func (m *MockTracer) BufferedPacket(arg0 logging.PacketType) { func (m *MockConnectionTracer) BufferedPacket(arg0 logging.PacketType) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
m.ctrl.Call(m, "BufferedPacket", arg0) m.ctrl.Call(m, "BufferedPacket", arg0)
} }
// BufferedPacket indicates an expected call of BufferedPacket // BufferedPacket indicates an expected call of BufferedPacket
func (mr *MockTracerMockRecorder) BufferedPacket(arg0 interface{}) *gomock.Call { func (mr *MockConnectionTracerMockRecorder) BufferedPacket(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BufferedPacket", reflect.TypeOf((*MockTracer)(nil).BufferedPacket), arg0) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BufferedPacket", reflect.TypeOf((*MockConnectionTracer)(nil).BufferedPacket), arg0)
} }
// Close mocks base method // Close mocks base method
func (m *MockTracer) Close() { func (m *MockConnectionTracer) Close() {
m.ctrl.T.Helper() m.ctrl.T.Helper()
m.ctrl.Call(m, "Close") m.ctrl.Call(m, "Close")
} }
// Close indicates an expected call of Close // Close indicates an expected call of Close
func (mr *MockTracerMockRecorder) Close() *gomock.Call { func (mr *MockConnectionTracerMockRecorder) Close() *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockTracer)(nil).Close)) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockConnectionTracer)(nil).Close))
} }
// ClosedConnection mocks base method // ClosedConnection mocks base method
func (m *MockTracer) ClosedConnection(arg0 logging.CloseReason) { func (m *MockConnectionTracer) ClosedConnection(arg0 logging.CloseReason) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
m.ctrl.Call(m, "ClosedConnection", arg0) m.ctrl.Call(m, "ClosedConnection", arg0)
} }
// ClosedConnection indicates an expected call of ClosedConnection // ClosedConnection indicates an expected call of ClosedConnection
func (mr *MockTracerMockRecorder) ClosedConnection(arg0 interface{}) *gomock.Call { func (mr *MockConnectionTracerMockRecorder) ClosedConnection(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ClosedConnection", reflect.TypeOf((*MockTracer)(nil).ClosedConnection), arg0) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ClosedConnection", reflect.TypeOf((*MockConnectionTracer)(nil).ClosedConnection), arg0)
} }
// DroppedEncryptionLevel mocks base method // DroppedEncryptionLevel mocks base method
func (m *MockTracer) DroppedEncryptionLevel(arg0 protocol.EncryptionLevel) { func (m *MockConnectionTracer) DroppedEncryptionLevel(arg0 protocol.EncryptionLevel) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
m.ctrl.Call(m, "DroppedEncryptionLevel", arg0) m.ctrl.Call(m, "DroppedEncryptionLevel", arg0)
} }
// DroppedEncryptionLevel indicates an expected call of DroppedEncryptionLevel // DroppedEncryptionLevel indicates an expected call of DroppedEncryptionLevel
func (mr *MockTracerMockRecorder) DroppedEncryptionLevel(arg0 interface{}) *gomock.Call { func (mr *MockConnectionTracerMockRecorder) DroppedEncryptionLevel(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DroppedEncryptionLevel", reflect.TypeOf((*MockTracer)(nil).DroppedEncryptionLevel), arg0) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DroppedEncryptionLevel", reflect.TypeOf((*MockConnectionTracer)(nil).DroppedEncryptionLevel), arg0)
} }
// DroppedPacket mocks base method // DroppedPacket mocks base method
func (m *MockTracer) DroppedPacket(arg0 logging.PacketType, arg1 protocol.ByteCount, arg2 logging.PacketDropReason) { func (m *MockConnectionTracer) DroppedPacket(arg0 logging.PacketType, arg1 protocol.ByteCount, arg2 logging.PacketDropReason) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
m.ctrl.Call(m, "DroppedPacket", arg0, arg1, arg2) m.ctrl.Call(m, "DroppedPacket", arg0, arg1, arg2)
} }
// DroppedPacket indicates an expected call of DroppedPacket // DroppedPacket indicates an expected call of DroppedPacket
func (mr *MockTracerMockRecorder) DroppedPacket(arg0, arg1, arg2 interface{}) *gomock.Call { func (mr *MockConnectionTracerMockRecorder) DroppedPacket(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DroppedPacket", reflect.TypeOf((*MockTracer)(nil).DroppedPacket), arg0, arg1, arg2) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DroppedPacket", reflect.TypeOf((*MockConnectionTracer)(nil).DroppedPacket), arg0, arg1, arg2)
} }
// LossTimerCanceled mocks base method // LossTimerCanceled mocks base method
func (m *MockTracer) LossTimerCanceled() { func (m *MockConnectionTracer) LossTimerCanceled() {
m.ctrl.T.Helper() m.ctrl.T.Helper()
m.ctrl.Call(m, "LossTimerCanceled") m.ctrl.Call(m, "LossTimerCanceled")
} }
// LossTimerCanceled indicates an expected call of LossTimerCanceled // LossTimerCanceled indicates an expected call of LossTimerCanceled
func (mr *MockTracerMockRecorder) LossTimerCanceled() *gomock.Call { func (mr *MockConnectionTracerMockRecorder) LossTimerCanceled() *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LossTimerCanceled", reflect.TypeOf((*MockTracer)(nil).LossTimerCanceled)) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LossTimerCanceled", reflect.TypeOf((*MockConnectionTracer)(nil).LossTimerCanceled))
} }
// LossTimerExpired mocks base method // LossTimerExpired mocks base method
func (m *MockTracer) LossTimerExpired(arg0 logging.TimerType, arg1 protocol.EncryptionLevel) { func (m *MockConnectionTracer) LossTimerExpired(arg0 logging.TimerType, arg1 protocol.EncryptionLevel) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
m.ctrl.Call(m, "LossTimerExpired", arg0, arg1) m.ctrl.Call(m, "LossTimerExpired", arg0, arg1)
} }
// LossTimerExpired indicates an expected call of LossTimerExpired // LossTimerExpired indicates an expected call of LossTimerExpired
func (mr *MockTracerMockRecorder) LossTimerExpired(arg0, arg1 interface{}) *gomock.Call { func (mr *MockConnectionTracerMockRecorder) LossTimerExpired(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LossTimerExpired", reflect.TypeOf((*MockTracer)(nil).LossTimerExpired), arg0, arg1) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LossTimerExpired", reflect.TypeOf((*MockConnectionTracer)(nil).LossTimerExpired), arg0, arg1)
} }
// LostPacket mocks base method // LostPacket mocks base method
func (m *MockTracer) LostPacket(arg0 protocol.EncryptionLevel, arg1 protocol.PacketNumber, arg2 logging.PacketLossReason) { func (m *MockConnectionTracer) LostPacket(arg0 protocol.EncryptionLevel, arg1 protocol.PacketNumber, arg2 logging.PacketLossReason) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
m.ctrl.Call(m, "LostPacket", arg0, arg1, arg2) m.ctrl.Call(m, "LostPacket", arg0, arg1, arg2)
} }
// LostPacket indicates an expected call of LostPacket // LostPacket indicates an expected call of LostPacket
func (mr *MockTracerMockRecorder) LostPacket(arg0, arg1, arg2 interface{}) *gomock.Call { func (mr *MockConnectionTracerMockRecorder) LostPacket(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LostPacket", reflect.TypeOf((*MockTracer)(nil).LostPacket), arg0, arg1, arg2) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LostPacket", reflect.TypeOf((*MockConnectionTracer)(nil).LostPacket), arg0, arg1, arg2)
} }
// ReceivedPacket mocks base method // ReceivedPacket mocks base method
func (m *MockTracer) ReceivedPacket(arg0 *wire.ExtendedHeader, arg1 protocol.ByteCount, arg2 []wire.Frame) { func (m *MockConnectionTracer) ReceivedPacket(arg0 *wire.ExtendedHeader, arg1 protocol.ByteCount, arg2 []wire.Frame) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
m.ctrl.Call(m, "ReceivedPacket", arg0, arg1, arg2) m.ctrl.Call(m, "ReceivedPacket", arg0, arg1, arg2)
} }
// ReceivedPacket indicates an expected call of ReceivedPacket // ReceivedPacket indicates an expected call of ReceivedPacket
func (mr *MockTracerMockRecorder) ReceivedPacket(arg0, arg1, arg2 interface{}) *gomock.Call { func (mr *MockConnectionTracerMockRecorder) ReceivedPacket(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReceivedPacket", reflect.TypeOf((*MockTracer)(nil).ReceivedPacket), arg0, arg1, arg2) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReceivedPacket", reflect.TypeOf((*MockConnectionTracer)(nil).ReceivedPacket), arg0, arg1, arg2)
} }
// ReceivedRetry mocks base method // ReceivedRetry mocks base method
func (m *MockTracer) ReceivedRetry(arg0 *wire.Header) { func (m *MockConnectionTracer) ReceivedRetry(arg0 *wire.Header) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
m.ctrl.Call(m, "ReceivedRetry", arg0) m.ctrl.Call(m, "ReceivedRetry", arg0)
} }
// ReceivedRetry indicates an expected call of ReceivedRetry // ReceivedRetry indicates an expected call of ReceivedRetry
func (mr *MockTracerMockRecorder) ReceivedRetry(arg0 interface{}) *gomock.Call { func (mr *MockConnectionTracerMockRecorder) ReceivedRetry(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReceivedRetry", reflect.TypeOf((*MockTracer)(nil).ReceivedRetry), arg0) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReceivedRetry", reflect.TypeOf((*MockConnectionTracer)(nil).ReceivedRetry), arg0)
} }
// ReceivedStatelessReset mocks base method // ReceivedStatelessReset mocks base method
func (m *MockTracer) ReceivedStatelessReset(arg0 *[16]byte) { func (m *MockConnectionTracer) ReceivedStatelessReset(arg0 *[16]byte) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
m.ctrl.Call(m, "ReceivedStatelessReset", arg0) m.ctrl.Call(m, "ReceivedStatelessReset", arg0)
} }
// ReceivedStatelessReset indicates an expected call of ReceivedStatelessReset // ReceivedStatelessReset indicates an expected call of ReceivedStatelessReset
func (mr *MockTracerMockRecorder) ReceivedStatelessReset(arg0 interface{}) *gomock.Call { func (mr *MockConnectionTracerMockRecorder) ReceivedStatelessReset(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReceivedStatelessReset", reflect.TypeOf((*MockTracer)(nil).ReceivedStatelessReset), arg0) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReceivedStatelessReset", reflect.TypeOf((*MockConnectionTracer)(nil).ReceivedStatelessReset), arg0)
} }
// ReceivedTransportParameters mocks base method // ReceivedTransportParameters mocks base method
func (m *MockTracer) ReceivedTransportParameters(arg0 *wire.TransportParameters) { func (m *MockConnectionTracer) ReceivedTransportParameters(arg0 *wire.TransportParameters) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
m.ctrl.Call(m, "ReceivedTransportParameters", arg0) m.ctrl.Call(m, "ReceivedTransportParameters", arg0)
} }
// ReceivedTransportParameters indicates an expected call of ReceivedTransportParameters // ReceivedTransportParameters indicates an expected call of ReceivedTransportParameters
func (mr *MockTracerMockRecorder) ReceivedTransportParameters(arg0 interface{}) *gomock.Call { func (mr *MockConnectionTracerMockRecorder) ReceivedTransportParameters(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReceivedTransportParameters", reflect.TypeOf((*MockTracer)(nil).ReceivedTransportParameters), arg0) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReceivedTransportParameters", reflect.TypeOf((*MockConnectionTracer)(nil).ReceivedTransportParameters), arg0)
} }
// ReceivedVersionNegotiationPacket mocks base method // ReceivedVersionNegotiationPacket mocks base method
func (m *MockTracer) ReceivedVersionNegotiationPacket(arg0 *wire.Header) { func (m *MockConnectionTracer) ReceivedVersionNegotiationPacket(arg0 *wire.Header) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
m.ctrl.Call(m, "ReceivedVersionNegotiationPacket", arg0) m.ctrl.Call(m, "ReceivedVersionNegotiationPacket", arg0)
} }
// ReceivedVersionNegotiationPacket indicates an expected call of ReceivedVersionNegotiationPacket // ReceivedVersionNegotiationPacket indicates an expected call of ReceivedVersionNegotiationPacket
func (mr *MockTracerMockRecorder) ReceivedVersionNegotiationPacket(arg0 interface{}) *gomock.Call { func (mr *MockConnectionTracerMockRecorder) ReceivedVersionNegotiationPacket(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReceivedVersionNegotiationPacket", reflect.TypeOf((*MockTracer)(nil).ReceivedVersionNegotiationPacket), arg0) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReceivedVersionNegotiationPacket", reflect.TypeOf((*MockConnectionTracer)(nil).ReceivedVersionNegotiationPacket), arg0)
} }
// SentPacket mocks base method // SentPacket mocks base method
func (m *MockTracer) SentPacket(arg0 *wire.ExtendedHeader, arg1 protocol.ByteCount, arg2 *wire.AckFrame, arg3 []wire.Frame) { func (m *MockConnectionTracer) SentPacket(arg0 *wire.ExtendedHeader, arg1 protocol.ByteCount, arg2 *wire.AckFrame, arg3 []wire.Frame) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
m.ctrl.Call(m, "SentPacket", arg0, arg1, arg2, arg3) m.ctrl.Call(m, "SentPacket", arg0, arg1, arg2, arg3)
} }
// SentPacket indicates an expected call of SentPacket // SentPacket indicates an expected call of SentPacket
func (mr *MockTracerMockRecorder) SentPacket(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { func (mr *MockConnectionTracerMockRecorder) SentPacket(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SentPacket", reflect.TypeOf((*MockTracer)(nil).SentPacket), arg0, arg1, arg2, arg3) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SentPacket", reflect.TypeOf((*MockConnectionTracer)(nil).SentPacket), arg0, arg1, arg2, arg3)
} }
// SentTransportParameters mocks base method // SentTransportParameters mocks base method
func (m *MockTracer) SentTransportParameters(arg0 *wire.TransportParameters) { func (m *MockConnectionTracer) SentTransportParameters(arg0 *wire.TransportParameters) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
m.ctrl.Call(m, "SentTransportParameters", arg0) m.ctrl.Call(m, "SentTransportParameters", arg0)
} }
// SentTransportParameters indicates an expected call of SentTransportParameters // SentTransportParameters indicates an expected call of SentTransportParameters
func (mr *MockTracerMockRecorder) SentTransportParameters(arg0 interface{}) *gomock.Call { func (mr *MockConnectionTracerMockRecorder) SentTransportParameters(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SentTransportParameters", reflect.TypeOf((*MockTracer)(nil).SentTransportParameters), arg0) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SentTransportParameters", reflect.TypeOf((*MockConnectionTracer)(nil).SentTransportParameters), arg0)
} }
// SetLossTimer mocks base method // SetLossTimer mocks base method
func (m *MockTracer) SetLossTimer(arg0 logging.TimerType, arg1 protocol.EncryptionLevel, arg2 time.Time) { func (m *MockConnectionTracer) SetLossTimer(arg0 logging.TimerType, arg1 protocol.EncryptionLevel, arg2 time.Time) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
m.ctrl.Call(m, "SetLossTimer", arg0, arg1, arg2) m.ctrl.Call(m, "SetLossTimer", arg0, arg1, arg2)
} }
// SetLossTimer indicates an expected call of SetLossTimer // SetLossTimer indicates an expected call of SetLossTimer
func (mr *MockTracerMockRecorder) SetLossTimer(arg0, arg1, arg2 interface{}) *gomock.Call { func (mr *MockConnectionTracerMockRecorder) SetLossTimer(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetLossTimer", reflect.TypeOf((*MockTracer)(nil).SetLossTimer), arg0, arg1, arg2) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetLossTimer", reflect.TypeOf((*MockConnectionTracer)(nil).SetLossTimer), arg0, arg1, arg2)
} }
// StartedConnection mocks base method // StartedConnection mocks base method
func (m *MockTracer) StartedConnection(arg0, arg1 net.Addr, arg2 protocol.VersionNumber, arg3, arg4 protocol.ConnectionID) { func (m *MockConnectionTracer) StartedConnection(arg0, arg1 net.Addr, arg2 protocol.VersionNumber, arg3, arg4 protocol.ConnectionID) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
m.ctrl.Call(m, "StartedConnection", arg0, arg1, arg2, arg3, arg4) m.ctrl.Call(m, "StartedConnection", arg0, arg1, arg2, arg3, arg4)
} }
// StartedConnection indicates an expected call of StartedConnection // StartedConnection indicates an expected call of StartedConnection
func (mr *MockTracerMockRecorder) StartedConnection(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { func (mr *MockConnectionTracerMockRecorder) StartedConnection(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StartedConnection", reflect.TypeOf((*MockTracer)(nil).StartedConnection), arg0, arg1, arg2, arg3, arg4) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StartedConnection", reflect.TypeOf((*MockConnectionTracer)(nil).StartedConnection), arg0, arg1, arg2, arg3, arg4)
} }
// UpdatedKey mocks base method // UpdatedKey mocks base method
func (m *MockTracer) UpdatedKey(arg0 protocol.KeyPhase, arg1 bool) { func (m *MockConnectionTracer) UpdatedKey(arg0 protocol.KeyPhase, arg1 bool) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
m.ctrl.Call(m, "UpdatedKey", arg0, arg1) m.ctrl.Call(m, "UpdatedKey", arg0, arg1)
} }
// UpdatedKey indicates an expected call of UpdatedKey // UpdatedKey indicates an expected call of UpdatedKey
func (mr *MockTracerMockRecorder) UpdatedKey(arg0, arg1 interface{}) *gomock.Call { func (mr *MockConnectionTracerMockRecorder) UpdatedKey(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatedKey", reflect.TypeOf((*MockTracer)(nil).UpdatedKey), arg0, arg1) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatedKey", reflect.TypeOf((*MockConnectionTracer)(nil).UpdatedKey), arg0, arg1)
} }
// UpdatedKeyFromTLS mocks base method // UpdatedKeyFromTLS mocks base method
func (m *MockTracer) UpdatedKeyFromTLS(arg0 protocol.EncryptionLevel, arg1 protocol.Perspective) { func (m *MockConnectionTracer) UpdatedKeyFromTLS(arg0 protocol.EncryptionLevel, arg1 protocol.Perspective) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
m.ctrl.Call(m, "UpdatedKeyFromTLS", arg0, arg1) m.ctrl.Call(m, "UpdatedKeyFromTLS", arg0, arg1)
} }
// UpdatedKeyFromTLS indicates an expected call of UpdatedKeyFromTLS // UpdatedKeyFromTLS indicates an expected call of UpdatedKeyFromTLS
func (mr *MockTracerMockRecorder) UpdatedKeyFromTLS(arg0, arg1 interface{}) *gomock.Call { func (mr *MockConnectionTracerMockRecorder) UpdatedKeyFromTLS(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatedKeyFromTLS", reflect.TypeOf((*MockTracer)(nil).UpdatedKeyFromTLS), arg0, arg1) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatedKeyFromTLS", reflect.TypeOf((*MockConnectionTracer)(nil).UpdatedKeyFromTLS), arg0, arg1)
} }
// UpdatedMetrics mocks base method // UpdatedMetrics mocks base method
func (m *MockTracer) UpdatedMetrics(arg0 *congestion.RTTStats, arg1, arg2 protocol.ByteCount, arg3 int) { func (m *MockConnectionTracer) UpdatedMetrics(arg0 *congestion.RTTStats, arg1, arg2 protocol.ByteCount, arg3 int) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
m.ctrl.Call(m, "UpdatedMetrics", arg0, arg1, arg2, arg3) m.ctrl.Call(m, "UpdatedMetrics", arg0, arg1, arg2, arg3)
} }
// UpdatedMetrics indicates an expected call of UpdatedMetrics // UpdatedMetrics indicates an expected call of UpdatedMetrics
func (mr *MockTracerMockRecorder) UpdatedMetrics(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { func (mr *MockConnectionTracerMockRecorder) UpdatedMetrics(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatedMetrics", reflect.TypeOf((*MockTracer)(nil).UpdatedMetrics), arg0, arg1, arg2, arg3) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatedMetrics", reflect.TypeOf((*MockConnectionTracer)(nil).UpdatedMetrics), arg0, arg1, arg2, arg3)
} }
// UpdatedPTOCount mocks base method // UpdatedPTOCount mocks base method
func (m *MockTracer) UpdatedPTOCount(arg0 uint32) { func (m *MockConnectionTracer) UpdatedPTOCount(arg0 uint32) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
m.ctrl.Call(m, "UpdatedPTOCount", arg0) m.ctrl.Call(m, "UpdatedPTOCount", arg0)
} }
// UpdatedPTOCount indicates an expected call of UpdatedPTOCount // UpdatedPTOCount indicates an expected call of UpdatedPTOCount
func (mr *MockTracerMockRecorder) UpdatedPTOCount(arg0 interface{}) *gomock.Call { func (mr *MockConnectionTracerMockRecorder) UpdatedPTOCount(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatedPTOCount", reflect.TypeOf((*MockTracer)(nil).UpdatedPTOCount), arg0) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdatedPTOCount", reflect.TypeOf((*MockConnectionTracer)(nil).UpdatedPTOCount), arg0)
} }

View file

@ -3,7 +3,7 @@ package mocks
//go:generate sh -c "mockgen -package mockquic -destination quic/stream.go github.com/lucas-clemente/quic-go Stream && goimports -w quic/stream.go" //go:generate sh -c "mockgen -package mockquic -destination quic/stream.go github.com/lucas-clemente/quic-go Stream && goimports -w quic/stream.go"
//go:generate sh -c "mockgen -package mockquic -destination quic/early_session.go github.com/lucas-clemente/quic-go EarlySession && goimports -w quic/early_session.go" //go:generate sh -c "mockgen -package mockquic -destination quic/early_session.go github.com/lucas-clemente/quic-go EarlySession && goimports -w quic/early_session.go"
//go:generate sh -c "mockgen -package mockquic -destination quic/early_listener.go github.com/lucas-clemente/quic-go EarlyListener && goimports -w quic/early_listener.go" //go:generate sh -c "mockgen -package mockquic -destination quic/early_listener.go github.com/lucas-clemente/quic-go EarlyListener && goimports -w quic/early_listener.go"
//go:generate sh -c "mockgen -package mocks -destination logging.go github.com/lucas-clemente/quic-go/logging Tracer && goimports -w logging.go" //go:generate sh -c "mockgen -package mocks -destination connection_tracer.go github.com/lucas-clemente/quic-go/logging ConnectionTracer && goimports -w connection_tracer.go"
//go:generate sh -c "mockgen -package mocks -destination short_header_sealer.go github.com/lucas-clemente/quic-go/internal/handshake ShortHeaderSealer && goimports -w short_header_sealer.go" //go:generate sh -c "mockgen -package mocks -destination short_header_sealer.go github.com/lucas-clemente/quic-go/internal/handshake ShortHeaderSealer && goimports -w short_header_sealer.go"
//go:generate sh -c "mockgen -package mocks -destination short_header_opener.go github.com/lucas-clemente/quic-go/internal/handshake ShortHeaderOpener && goimports -w short_header_opener.go" //go:generate sh -c "mockgen -package mocks -destination short_header_opener.go github.com/lucas-clemente/quic-go/internal/handshake ShortHeaderOpener && goimports -w short_header_opener.go"
//go:generate sh -c "mockgen -package mocks -destination long_header_opener.go github.com/lucas-clemente/quic-go/internal/handshake LongHeaderOpener && goimports -w long_header_opener.go" //go:generate sh -c "mockgen -package mocks -destination long_header_opener.go github.com/lucas-clemente/quic-go/internal/handshake LongHeaderOpener && goimports -w long_header_opener.go"

View file

@ -11,8 +11,8 @@ import (
"github.com/lucas-clemente/quic-go/internal/wire" "github.com/lucas-clemente/quic-go/internal/wire"
) )
// A Tracer records events. // A ConnectionTracer records events.
type Tracer interface { type ConnectionTracer interface {
StartedConnection(local, remote net.Addr, version protocol.VersionNumber, srcConnID, destConnID protocol.ConnectionID) StartedConnection(local, remote net.Addr, version protocol.VersionNumber, srcConnID, destConnID protocol.ConnectionID)
ClosedConnection(CloseReason) ClosedConnection(CloseReason)
SentTransportParameters(*wire.TransportParameters) SentTransportParameters(*wire.TransportParameters)

View file

@ -19,7 +19,7 @@ import (
const eventChanSize = 50 const eventChanSize = 50
type tracer struct { type connectionTracer struct {
mutex sync.Mutex mutex sync.Mutex
w io.WriteCloser w io.WriteCloser
@ -35,11 +35,11 @@ type tracer struct {
lastMetrics *metrics lastMetrics *metrics
} }
var _ logging.Tracer = &tracer{} var _ logging.ConnectionTracer = &connectionTracer{}
// NewTracer creates a new tracer to record a qlog. // NewTracer creates a new connectionTracer to record a qlog.
func NewTracer(w io.WriteCloser, p protocol.Perspective, odcid protocol.ConnectionID) logging.Tracer { func NewTracer(w io.WriteCloser, p protocol.Perspective, odcid protocol.ConnectionID) logging.ConnectionTracer {
t := &tracer{ t := &connectionTracer{
w: w, w: w,
perspective: p, perspective: p,
odcid: odcid, odcid: odcid,
@ -51,7 +51,7 @@ func NewTracer(w io.WriteCloser, p protocol.Perspective, odcid protocol.Connecti
return t return t
} }
func (t *tracer) run() { func (t *connectionTracer) run() {
defer close(t.runStopped) defer close(t.runStopped)
buf := &bytes.Buffer{} buf := &bytes.Buffer{}
enc := gojay.NewEncoder(buf) enc := gojay.NewEncoder(buf)
@ -91,14 +91,14 @@ func (t *tracer) run() {
} }
} }
func (t *tracer) Close() { func (t *connectionTracer) Close() {
if err := t.export(); err != nil { if err := t.export(); err != nil {
log.Printf("exporting qlog failed: %s\n", err) log.Printf("exporting qlog failed: %s\n", err)
} }
} }
// export writes a qlog. // export writes a qlog.
func (t *tracer) export() error { func (t *connectionTracer) export() error {
close(t.events) close(t.events)
<-t.runStopped <-t.runStopped
if t.encodeErr != nil { if t.encodeErr != nil {
@ -110,14 +110,14 @@ func (t *tracer) export() error {
return t.w.Close() return t.w.Close()
} }
func (t *tracer) recordEvent(eventTime time.Time, details eventDetails) { func (t *connectionTracer) recordEvent(eventTime time.Time, details eventDetails) {
t.events <- event{ t.events <- event{
RelativeTime: eventTime.Sub(t.referenceTime), RelativeTime: eventTime.Sub(t.referenceTime),
eventDetails: details, eventDetails: details,
} }
} }
func (t *tracer) StartedConnection(local, remote net.Addr, version protocol.VersionNumber, srcConnID, destConnID protocol.ConnectionID) { func (t *connectionTracer) StartedConnection(local, remote net.Addr, version protocol.VersionNumber, srcConnID, destConnID protocol.ConnectionID) {
// ignore this event if we're not dealing with UDP addresses here // ignore this event if we're not dealing with UDP addresses here
localAddr, ok := local.(*net.UDPAddr) localAddr, ok := local.(*net.UDPAddr)
if !ok { if !ok {
@ -138,21 +138,21 @@ func (t *tracer) StartedConnection(local, remote net.Addr, version protocol.Vers
t.mutex.Unlock() t.mutex.Unlock()
} }
func (t *tracer) ClosedConnection(r logging.CloseReason) { func (t *connectionTracer) ClosedConnection(r logging.CloseReason) {
t.mutex.Lock() t.mutex.Lock()
t.recordEvent(time.Now(), &eventConnectionClosed{Reason: r}) t.recordEvent(time.Now(), &eventConnectionClosed{Reason: r})
t.mutex.Unlock() t.mutex.Unlock()
} }
func (t *tracer) SentTransportParameters(tp *wire.TransportParameters) { func (t *connectionTracer) SentTransportParameters(tp *wire.TransportParameters) {
t.recordTransportParameters(t.perspective, tp) t.recordTransportParameters(t.perspective, tp)
} }
func (t *tracer) ReceivedTransportParameters(tp *wire.TransportParameters) { func (t *connectionTracer) ReceivedTransportParameters(tp *wire.TransportParameters) {
t.recordTransportParameters(t.perspective.Opposite(), tp) t.recordTransportParameters(t.perspective.Opposite(), tp)
} }
func (t *tracer) recordTransportParameters(sentBy protocol.Perspective, tp *wire.TransportParameters) { func (t *connectionTracer) recordTransportParameters(sentBy protocol.Perspective, tp *wire.TransportParameters) {
owner := ownerLocal owner := ownerLocal
if sentBy != t.perspective { if sentBy != t.perspective {
owner = ownerRemote owner = ownerRemote
@ -181,7 +181,7 @@ func (t *tracer) recordTransportParameters(sentBy protocol.Perspective, tp *wire
t.mutex.Unlock() t.mutex.Unlock()
} }
func (t *tracer) SentPacket(hdr *wire.ExtendedHeader, packetSize protocol.ByteCount, ack *wire.AckFrame, frames []wire.Frame) { func (t *connectionTracer) SentPacket(hdr *wire.ExtendedHeader, packetSize protocol.ByteCount, ack *wire.AckFrame, frames []wire.Frame) {
numFrames := len(frames) numFrames := len(frames)
if ack != nil { if ack != nil {
numFrames++ numFrames++
@ -204,7 +204,7 @@ func (t *tracer) SentPacket(hdr *wire.ExtendedHeader, packetSize protocol.ByteCo
t.mutex.Unlock() t.mutex.Unlock()
} }
func (t *tracer) ReceivedPacket(hdr *wire.ExtendedHeader, packetSize protocol.ByteCount, frames []wire.Frame) { func (t *connectionTracer) ReceivedPacket(hdr *wire.ExtendedHeader, packetSize protocol.ByteCount, frames []wire.Frame) {
fs := make([]frame, len(frames)) fs := make([]frame, len(frames))
for i, f := range frames { for i, f := range frames {
fs[i] = *transformFrame(f) fs[i] = *transformFrame(f)
@ -220,7 +220,7 @@ func (t *tracer) ReceivedPacket(hdr *wire.ExtendedHeader, packetSize protocol.By
t.mutex.Unlock() t.mutex.Unlock()
} }
func (t *tracer) ReceivedRetry(hdr *wire.Header) { func (t *connectionTracer) ReceivedRetry(hdr *wire.Header) {
t.mutex.Lock() t.mutex.Lock()
t.recordEvent(time.Now(), &eventRetryReceived{ t.recordEvent(time.Now(), &eventRetryReceived{
Header: *transformHeader(hdr), Header: *transformHeader(hdr),
@ -228,7 +228,7 @@ func (t *tracer) ReceivedRetry(hdr *wire.Header) {
t.mutex.Unlock() t.mutex.Unlock()
} }
func (t *tracer) ReceivedVersionNegotiationPacket(hdr *wire.Header) { func (t *connectionTracer) ReceivedVersionNegotiationPacket(hdr *wire.Header) {
versions := make([]versionNumber, len(hdr.SupportedVersions)) versions := make([]versionNumber, len(hdr.SupportedVersions))
for i, v := range hdr.SupportedVersions { for i, v := range hdr.SupportedVersions {
versions[i] = versionNumber(v) versions[i] = versionNumber(v)
@ -241,7 +241,7 @@ func (t *tracer) ReceivedVersionNegotiationPacket(hdr *wire.Header) {
t.mutex.Unlock() t.mutex.Unlock()
} }
func (t *tracer) ReceivedStatelessReset(token *[16]byte) { func (t *connectionTracer) ReceivedStatelessReset(token *[16]byte) {
t.mutex.Lock() t.mutex.Lock()
t.recordEvent(time.Now(), &eventStatelessResetReceived{ t.recordEvent(time.Now(), &eventStatelessResetReceived{
Token: token, Token: token,
@ -249,13 +249,13 @@ func (t *tracer) ReceivedStatelessReset(token *[16]byte) {
t.mutex.Unlock() t.mutex.Unlock()
} }
func (t *tracer) BufferedPacket(packetType logging.PacketType) { func (t *connectionTracer) BufferedPacket(packetType logging.PacketType) {
t.mutex.Lock() t.mutex.Lock()
t.recordEvent(time.Now(), &eventPacketBuffered{PacketType: packetType}) t.recordEvent(time.Now(), &eventPacketBuffered{PacketType: packetType})
t.mutex.Unlock() t.mutex.Unlock()
} }
func (t *tracer) DroppedPacket(packetType logging.PacketType, size protocol.ByteCount, dropReason logging.PacketDropReason) { func (t *connectionTracer) DroppedPacket(packetType logging.PacketType, size protocol.ByteCount, dropReason logging.PacketDropReason) {
t.mutex.Lock() t.mutex.Lock()
t.recordEvent(time.Now(), &eventPacketDropped{ t.recordEvent(time.Now(), &eventPacketDropped{
PacketType: packetType, PacketType: packetType,
@ -265,7 +265,7 @@ func (t *tracer) DroppedPacket(packetType logging.PacketType, size protocol.Byte
t.mutex.Unlock() t.mutex.Unlock()
} }
func (t *tracer) UpdatedMetrics(rttStats *congestion.RTTStats, cwnd, bytesInFlight protocol.ByteCount, packetsInFlight int) { func (t *connectionTracer) UpdatedMetrics(rttStats *congestion.RTTStats, cwnd, bytesInFlight protocol.ByteCount, packetsInFlight int) {
m := &metrics{ m := &metrics{
MinRTT: rttStats.MinRTT(), MinRTT: rttStats.MinRTT(),
SmoothedRTT: rttStats.SmoothedRTT(), SmoothedRTT: rttStats.SmoothedRTT(),
@ -284,7 +284,7 @@ func (t *tracer) UpdatedMetrics(rttStats *congestion.RTTStats, cwnd, bytesInFlig
t.mutex.Unlock() t.mutex.Unlock()
} }
func (t *tracer) LostPacket(encLevel protocol.EncryptionLevel, pn protocol.PacketNumber, lossReason logging.PacketLossReason) { func (t *connectionTracer) LostPacket(encLevel protocol.EncryptionLevel, pn protocol.PacketNumber, lossReason logging.PacketLossReason) {
t.mutex.Lock() t.mutex.Lock()
t.recordEvent(time.Now(), &eventPacketLost{ t.recordEvent(time.Now(), &eventPacketLost{
PacketType: getPacketTypeFromEncryptionLevel(encLevel), PacketType: getPacketTypeFromEncryptionLevel(encLevel),
@ -294,13 +294,13 @@ func (t *tracer) LostPacket(encLevel protocol.EncryptionLevel, pn protocol.Packe
t.mutex.Unlock() t.mutex.Unlock()
} }
func (t *tracer) UpdatedPTOCount(value uint32) { func (t *connectionTracer) UpdatedPTOCount(value uint32) {
t.mutex.Lock() t.mutex.Lock()
t.recordEvent(time.Now(), &eventUpdatedPTO{Value: value}) t.recordEvent(time.Now(), &eventUpdatedPTO{Value: value})
t.mutex.Unlock() t.mutex.Unlock()
} }
func (t *tracer) UpdatedKeyFromTLS(encLevel protocol.EncryptionLevel, pers protocol.Perspective) { func (t *connectionTracer) UpdatedKeyFromTLS(encLevel protocol.EncryptionLevel, pers protocol.Perspective) {
t.mutex.Lock() t.mutex.Lock()
t.recordEvent(time.Now(), &eventKeyUpdated{ t.recordEvent(time.Now(), &eventKeyUpdated{
Trigger: keyUpdateTLS, Trigger: keyUpdateTLS,
@ -309,7 +309,7 @@ func (t *tracer) UpdatedKeyFromTLS(encLevel protocol.EncryptionLevel, pers proto
t.mutex.Unlock() t.mutex.Unlock()
} }
func (t *tracer) UpdatedKey(generation protocol.KeyPhase, remote bool) { func (t *connectionTracer) UpdatedKey(generation protocol.KeyPhase, remote bool) {
trigger := keyUpdateLocal trigger := keyUpdateLocal
if remote { if remote {
trigger = keyUpdateRemote trigger = keyUpdateRemote
@ -329,7 +329,7 @@ func (t *tracer) UpdatedKey(generation protocol.KeyPhase, remote bool) {
t.mutex.Unlock() t.mutex.Unlock()
} }
func (t *tracer) DroppedEncryptionLevel(encLevel protocol.EncryptionLevel) { func (t *connectionTracer) DroppedEncryptionLevel(encLevel protocol.EncryptionLevel) {
t.mutex.Lock() t.mutex.Lock()
now := time.Now() now := time.Now()
t.recordEvent(now, &eventKeyRetired{KeyType: encLevelToKeyType(encLevel, protocol.PerspectiveServer)}) t.recordEvent(now, &eventKeyRetired{KeyType: encLevelToKeyType(encLevel, protocol.PerspectiveServer)})
@ -337,7 +337,7 @@ func (t *tracer) DroppedEncryptionLevel(encLevel protocol.EncryptionLevel) {
t.mutex.Unlock() t.mutex.Unlock()
} }
func (t *tracer) SetLossTimer(tt logging.TimerType, encLevel protocol.EncryptionLevel, timeout time.Time) { func (t *connectionTracer) SetLossTimer(tt logging.TimerType, encLevel protocol.EncryptionLevel, timeout time.Time) {
t.mutex.Lock() t.mutex.Lock()
now := time.Now() now := time.Now()
t.recordEvent(now, &eventLossTimerSet{ t.recordEvent(now, &eventLossTimerSet{
@ -348,7 +348,7 @@ func (t *tracer) SetLossTimer(tt logging.TimerType, encLevel protocol.Encryption
t.mutex.Unlock() t.mutex.Unlock()
} }
func (t *tracer) LossTimerExpired(tt logging.TimerType, encLevel protocol.EncryptionLevel) { func (t *connectionTracer) LossTimerExpired(tt logging.TimerType, encLevel protocol.EncryptionLevel) {
t.mutex.Lock() t.mutex.Lock()
t.recordEvent(time.Now(), &eventLossTimerExpired{ t.recordEvent(time.Now(), &eventLossTimerExpired{
TimerType: tt, TimerType: tt,
@ -357,7 +357,7 @@ func (t *tracer) LossTimerExpired(tt logging.TimerType, encLevel protocol.Encryp
t.mutex.Unlock() t.mutex.Unlock()
} }
func (t *tracer) LossTimerCanceled() { func (t *connectionTracer) LossTimerCanceled() {
t.mutex.Lock() t.mutex.Lock()
t.recordEvent(time.Now(), &eventLossTimerCanceled{}) t.recordEvent(time.Now(), &eventLossTimerCanceled{})
t.mutex.Unlock() t.mutex.Unlock()

View file

@ -51,7 +51,7 @@ type entry struct {
var _ = Describe("Tracer", func() { var _ = Describe("Tracer", func() {
var ( var (
tracer logging.Tracer tracer logging.ConnectionTracer
buf *bytes.Buffer buf *bytes.Buffer
) )

View file

@ -87,7 +87,7 @@ type baseServer struct {
*tls.Config, *tls.Config,
*handshake.TokenGenerator, *handshake.TokenGenerator,
bool, /* enable 0-RTT */ bool, /* enable 0-RTT */
logging.Tracer, logging.ConnectionTracer,
utils.Logger, utils.Logger,
protocol.VersionNumber, protocol.VersionNumber,
) quicSession ) quicSession
@ -447,7 +447,7 @@ func (s *baseServer) createNewSession(
) quicSession { ) quicSession {
var sess quicSession var sess quicSession
if added := s.sessionHandler.AddWithConnID(clientDestConnID, srcConnID, func() packetHandler { if added := s.sessionHandler.AddWithConnID(clientDestConnID, srcConnID, func() packetHandler {
var tracer logging.Tracer var tracer logging.ConnectionTracer
if s.config.GetLogWriter != nil { if s.config.GetLogWriter != nil {
// Use the same connection ID that is passed to the client's GetLogWriter callback. // Use the same connection ID that is passed to the client's GetLogWriter callback.
connID := clientDestConnID connID := clientDestConnID

View file

@ -335,7 +335,7 @@ var _ = Describe("Server", func() {
_ *tls.Config, _ *tls.Config,
_ *handshake.TokenGenerator, _ *handshake.TokenGenerator,
enable0RTT bool, enable0RTT bool,
_ logging.Tracer, _ logging.ConnectionTracer,
_ utils.Logger, _ utils.Logger,
_ protocol.VersionNumber, _ protocol.VersionNumber,
) quicSession { ) quicSession {
@ -508,7 +508,7 @@ var _ = Describe("Server", func() {
_ *tls.Config, _ *tls.Config,
_ *handshake.TokenGenerator, _ *handshake.TokenGenerator,
enable0RTT bool, enable0RTT bool,
_ logging.Tracer, _ logging.ConnectionTracer,
_ utils.Logger, _ utils.Logger,
_ protocol.VersionNumber, _ protocol.VersionNumber,
) quicSession { ) quicSession {
@ -575,7 +575,7 @@ var _ = Describe("Server", func() {
_ *tls.Config, _ *tls.Config,
_ *handshake.TokenGenerator, _ *handshake.TokenGenerator,
_ bool, _ bool,
_ logging.Tracer, _ logging.ConnectionTracer,
_ utils.Logger, _ utils.Logger,
_ protocol.VersionNumber, _ protocol.VersionNumber,
) quicSession { ) quicSession {
@ -618,7 +618,7 @@ var _ = Describe("Server", func() {
_ *tls.Config, _ *tls.Config,
_ *handshake.TokenGenerator, _ *handshake.TokenGenerator,
_ bool, _ bool,
_ logging.Tracer, _ logging.ConnectionTracer,
_ utils.Logger, _ utils.Logger,
_ protocol.VersionNumber, _ protocol.VersionNumber,
) quicSession { ) quicSession {
@ -666,7 +666,7 @@ var _ = Describe("Server", func() {
_ *tls.Config, _ *tls.Config,
_ *handshake.TokenGenerator, _ *handshake.TokenGenerator,
_ bool, _ bool,
_ logging.Tracer, _ logging.ConnectionTracer,
_ utils.Logger, _ utils.Logger,
_ protocol.VersionNumber, _ protocol.VersionNumber,
) quicSession { ) quicSession {
@ -696,7 +696,7 @@ var _ = Describe("Server", func() {
_ *tls.Config, _ *tls.Config,
_ *handshake.TokenGenerator, _ *handshake.TokenGenerator,
_ bool, _ bool,
_ logging.Tracer, _ logging.ConnectionTracer,
_ utils.Logger, _ utils.Logger,
_ protocol.VersionNumber, _ protocol.VersionNumber,
) quicSession { ) quicSession {
@ -761,7 +761,7 @@ var _ = Describe("Server", func() {
_ *tls.Config, _ *tls.Config,
_ *handshake.TokenGenerator, _ *handshake.TokenGenerator,
_ bool, _ bool,
_ logging.Tracer, _ logging.ConnectionTracer,
_ utils.Logger, _ utils.Logger,
_ protocol.VersionNumber, _ protocol.VersionNumber,
) quicSession { ) quicSession {
@ -869,7 +869,7 @@ var _ = Describe("Server", func() {
_ *tls.Config, _ *tls.Config,
_ *handshake.TokenGenerator, _ *handshake.TokenGenerator,
_ bool, _ bool,
_ logging.Tracer, _ logging.ConnectionTracer,
_ utils.Logger, _ utils.Logger,
_ protocol.VersionNumber, _ protocol.VersionNumber,
) quicSession { ) quicSession {
@ -936,7 +936,7 @@ var _ = Describe("Server", func() {
_ *tls.Config, _ *tls.Config,
_ *handshake.TokenGenerator, _ *handshake.TokenGenerator,
enable0RTT bool, enable0RTT bool,
_ logging.Tracer, _ logging.ConnectionTracer,
_ utils.Logger, _ utils.Logger,
_ protocol.VersionNumber, _ protocol.VersionNumber,
) quicSession { ) quicSession {
@ -974,7 +974,7 @@ var _ = Describe("Server", func() {
_ *tls.Config, _ *tls.Config,
_ *handshake.TokenGenerator, _ *handshake.TokenGenerator,
_ bool, _ bool,
_ logging.Tracer, _ logging.ConnectionTracer,
_ utils.Logger, _ utils.Logger,
_ protocol.VersionNumber, _ protocol.VersionNumber,
) quicSession { ) quicSession {
@ -1033,7 +1033,7 @@ var _ = Describe("Server", func() {
_ *tls.Config, _ *tls.Config,
_ *handshake.TokenGenerator, _ *handshake.TokenGenerator,
_ bool, _ bool,
_ logging.Tracer, _ logging.ConnectionTracer,
_ utils.Logger, _ utils.Logger,
_ protocol.VersionNumber, _ protocol.VersionNumber,
) quicSession { ) quicSession {

View file

@ -204,7 +204,7 @@ type session struct {
traceCallback func(quictrace.Event) traceCallback func(quictrace.Event)
logID string logID string
tracer logging.Tracer tracer logging.ConnectionTracer
logger utils.Logger logger utils.Logger
} }
@ -225,7 +225,7 @@ var newSession = func(
tlsConf *tls.Config, tlsConf *tls.Config,
tokenGenerator *handshake.TokenGenerator, tokenGenerator *handshake.TokenGenerator,
enable0RTT bool, enable0RTT bool,
tracer logging.Tracer, tracer logging.ConnectionTracer,
logger utils.Logger, logger utils.Logger,
v protocol.VersionNumber, v protocol.VersionNumber,
) quicSession { ) quicSession {
@ -350,7 +350,7 @@ var newClientSession = func(
initialVersion protocol.VersionNumber, initialVersion protocol.VersionNumber,
enable0RTT bool, enable0RTT bool,
hasNegotiatedVersion bool, hasNegotiatedVersion bool,
tracer logging.Tracer, tracer logging.ConnectionTracer,
logger utils.Logger, logger utils.Logger,
v protocol.VersionNumber, v protocol.VersionNumber,
) quicSession { ) quicSession {

View file

@ -49,7 +49,7 @@ var _ = Describe("Session", func() {
streamManager *MockStreamManager streamManager *MockStreamManager
packer *MockPacker packer *MockPacker
cryptoSetup *mocks.MockCryptoSetup cryptoSetup *mocks.MockCryptoSetup
tracer *mocks.MockTracer tracer *mocks.MockConnectionTracer
) )
remoteAddr := &net.UDPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 1337} remoteAddr := &net.UDPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 1337}
localAddr := &net.UDPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 7331} localAddr := &net.UDPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 7331}
@ -87,7 +87,7 @@ var _ = Describe("Session", func() {
mconn.EXPECT().LocalAddr().Return(localAddr).AnyTimes() mconn.EXPECT().LocalAddr().Return(localAddr).AnyTimes()
tokenGenerator, err := handshake.NewTokenGenerator() tokenGenerator, err := handshake.NewTokenGenerator()
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
tracer = mocks.NewMockTracer(mockCtrl) tracer = mocks.NewMockConnectionTracer(mockCtrl)
tracer.EXPECT().SentTransportParameters(gomock.Any()) tracer.EXPECT().SentTransportParameters(gomock.Any())
tracer.EXPECT().UpdatedKeyFromTLS(gomock.Any(), gomock.Any()).AnyTimes() tracer.EXPECT().UpdatedKeyFromTLS(gomock.Any(), gomock.Any()).AnyTimes()
sess = newSession( sess = newSession(
@ -1981,7 +1981,7 @@ var _ = Describe("Client Session", func() {
packer *MockPacker packer *MockPacker
mconn *MockConnection mconn *MockConnection
cryptoSetup *mocks.MockCryptoSetup cryptoSetup *mocks.MockCryptoSetup
tracer *mocks.MockTracer tracer *mocks.MockConnectionTracer
tlsConf *tls.Config tlsConf *tls.Config
quicConf *Config quicConf *Config
) )
@ -2020,7 +2020,7 @@ var _ = Describe("Client Session", func() {
tlsConf = &tls.Config{} tlsConf = &tls.Config{}
} }
sessionRunner = NewMockSessionRunner(mockCtrl) sessionRunner = NewMockSessionRunner(mockCtrl)
tracer = mocks.NewMockTracer(mockCtrl) tracer = mocks.NewMockConnectionTracer(mockCtrl)
tracer.EXPECT().SentTransportParameters(gomock.Any()) tracer.EXPECT().SentTransportParameters(gomock.Any())
tracer.EXPECT().UpdatedKeyFromTLS(gomock.Any(), gomock.Any()).AnyTimes() tracer.EXPECT().UpdatedKeyFromTLS(gomock.Any(), gomock.Any()).AnyTimes()
sess = newClientSession( sess = newClientSession(