diff --git a/client.go b/client.go index 57596ba0..4691d6d6 100644 --- a/client.go +++ b/client.go @@ -41,7 +41,7 @@ type client struct { session quicSession - tracer logging.Tracer + tracer logging.ConnectionTracer logger utils.Logger } diff --git a/client_test.go b/client_test.go index 67aefd7f..03698732 100644 --- a/client_test.go +++ b/client_test.go @@ -34,7 +34,7 @@ var _ = Describe("Client", func() { mockMultiplexer *MockMultiplexer origMultiplexer multiplexer tlsConf *tls.Config - tracer *mocks.MockTracer + tracer *mocks.MockConnectionTracer config *Config originalClientSessConstructor func( @@ -48,11 +48,11 @@ var _ = Describe("Client", func() { initialVersion protocol.VersionNumber, enable0RTT bool, hasNegotiatedVersion bool, - tracer logging.Tracer, + tracer logging.ConnectionTracer, logger utils.Logger, v protocol.VersionNumber, ) 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 @@ -71,8 +71,8 @@ var _ = Describe("Client", func() { connID = protocol.ConnectionID{0, 0, 0, 0, 0, 0, 0x13, 0x37} originalClientSessConstructor = newClientSession originalTracerConstructor = newTracer - tracer = mocks.NewMockTracer(mockCtrl) - newTracer = func(io.WriteCloser, protocol.Perspective, protocol.ConnectionID) logging.Tracer { + tracer = mocks.NewMockConnectionTracer(mockCtrl) + newTracer = func(io.WriteCloser, protocol.Perspective, protocol.ConnectionID) logging.ConnectionTracer { return tracer } config = &Config{ @@ -161,7 +161,7 @@ var _ = Describe("Client", func() { _ protocol.VersionNumber, _ bool, _ bool, - _ logging.Tracer, + _ logging.ConnectionTracer, _ utils.Logger, _ protocol.VersionNumber, ) quicSession { @@ -194,7 +194,7 @@ var _ = Describe("Client", func() { _ protocol.VersionNumber, _ bool, _ bool, - _ logging.Tracer, + _ logging.ConnectionTracer, _ utils.Logger, _ protocol.VersionNumber, ) quicSession { @@ -227,7 +227,7 @@ var _ = Describe("Client", func() { _ protocol.VersionNumber, _ bool, _ bool, - _ logging.Tracer, + _ logging.ConnectionTracer, _ utils.Logger, _ protocol.VersionNumber, ) quicSession { @@ -266,7 +266,7 @@ var _ = Describe("Client", func() { _ protocol.VersionNumber, enable0RTT bool, _ bool, - _ logging.Tracer, + _ logging.ConnectionTracer, _ utils.Logger, _ protocol.VersionNumber, ) quicSession { @@ -309,7 +309,7 @@ var _ = Describe("Client", func() { _ protocol.VersionNumber, enable0RTT bool, _ bool, - _ logging.Tracer, + _ logging.ConnectionTracer, _ utils.Logger, _ protocol.VersionNumber, ) quicSession { @@ -357,7 +357,7 @@ var _ = Describe("Client", func() { _ protocol.VersionNumber, _ bool, _ bool, - _ logging.Tracer, + _ logging.ConnectionTracer, _ utils.Logger, _ protocol.VersionNumber, ) quicSession { @@ -401,7 +401,7 @@ var _ = Describe("Client", func() { _ protocol.VersionNumber, _ bool, _ bool, - _ logging.Tracer, + _ logging.ConnectionTracer, _ utils.Logger, _ protocol.VersionNumber, ) quicSession { @@ -453,7 +453,7 @@ var _ = Describe("Client", func() { _ protocol.VersionNumber, _ bool, _ bool, - _ logging.Tracer, + _ logging.ConnectionTracer, _ utils.Logger, _ protocol.VersionNumber, ) quicSession { @@ -574,7 +574,7 @@ var _ = Describe("Client", func() { _ protocol.VersionNumber, /* initial version */ _ bool, _ bool, - _ logging.Tracer, + _ logging.ConnectionTracer, _ utils.Logger, versionP protocol.VersionNumber, ) quicSession { @@ -616,7 +616,7 @@ var _ = Describe("Client", func() { version protocol.VersionNumber, _ bool, hasNegotiatedVersion bool, - _ logging.Tracer, + _ logging.ConnectionTracer, _ utils.Logger, versionP protocol.VersionNumber, ) quicSession { diff --git a/internal/ackhandler/ackhandler.go b/internal/ackhandler/ackhandler.go index 7bb9369b..262c0156 100644 --- a/internal/ackhandler/ackhandler.go +++ b/internal/ackhandler/ackhandler.go @@ -14,7 +14,7 @@ func NewAckHandler( rttStats *congestion.RTTStats, pers protocol.Perspective, traceCallback func(quictrace.Event), - tracer logging.Tracer, + tracer logging.ConnectionTracer, logger utils.Logger, version protocol.VersionNumber, ) (SentPacketHandler, ReceivedPacketHandler) { diff --git a/internal/ackhandler/sent_packet_handler.go b/internal/ackhandler/sent_packet_handler.go index 748b8cc4..b87246ad 100644 --- a/internal/ackhandler/sent_packet_handler.go +++ b/internal/ackhandler/sent_packet_handler.go @@ -84,7 +84,7 @@ type sentPacketHandler struct { perspective protocol.Perspective traceCallback func(quictrace.Event) - tracer logging.Tracer + tracer logging.ConnectionTracer logger utils.Logger } @@ -96,7 +96,7 @@ func newSentPacketHandler( rttStats *congestion.RTTStats, pers protocol.Perspective, traceCallback func(quictrace.Event), - tracer logging.Tracer, + tracer logging.ConnectionTracer, logger utils.Logger, ) *sentPacketHandler { congestion := congestion.NewCubicSender( diff --git a/internal/handshake/crypto_setup.go b/internal/handshake/crypto_setup.go index 90dc1315..d2ce23a6 100644 --- a/internal/handshake/crypto_setup.go +++ b/internal/handshake/crypto_setup.go @@ -94,7 +94,7 @@ type cryptoSetup struct { rttStats *congestion.RTTStats - tracer logging.Tracer + tracer logging.ConnectionTracer logger utils.Logger perspective protocol.Perspective @@ -137,7 +137,7 @@ func NewCryptoSetupClient( tlsConf *tls.Config, enable0RTT bool, rttStats *congestion.RTTStats, - tracer logging.Tracer, + tracer logging.ConnectionTracer, logger utils.Logger, ) (CryptoSetup, <-chan *wire.TransportParameters /* ClientHello written. Receive nil for non-0-RTT */) { cs, clientHelloWritten := newCryptoSetup( @@ -169,7 +169,7 @@ func NewCryptoSetupServer( tlsConf *tls.Config, enable0RTT bool, rttStats *congestion.RTTStats, - tracer logging.Tracer, + tracer logging.ConnectionTracer, logger utils.Logger, ) CryptoSetup { cs, _ := newCryptoSetup( @@ -198,7 +198,7 @@ func newCryptoSetup( tlsConf *tls.Config, enable0RTT bool, rttStats *congestion.RTTStats, - tracer logging.Tracer, + tracer logging.ConnectionTracer, logger utils.Logger, perspective protocol.Perspective, ) (*cryptoSetup, <-chan *wire.TransportParameters /* ClientHello written. Receive nil for non-0-RTT */) { diff --git a/internal/handshake/updatable_aead.go b/internal/handshake/updatable_aead.go index 8e17d3c4..2da4d9c5 100644 --- a/internal/handshake/updatable_aead.go +++ b/internal/handshake/updatable_aead.go @@ -74,7 +74,7 @@ type updatableAEAD struct { rttStats *congestion.RTTStats - tracer logging.Tracer + tracer logging.ConnectionTracer logger utils.Logger // use a single slice to avoid allocations @@ -84,7 +84,7 @@ type updatableAEAD struct { var _ ShortHeaderOpener = &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{ firstPacketNumber: protocol.InvalidPacketNumber, largestAcked: protocol.InvalidPacketNumber, diff --git a/internal/mocks/logging.go b/internal/mocks/connection_tracer.go similarity index 50% rename from internal/mocks/logging.go rename to internal/mocks/connection_tracer.go index 5fb2cf0c..0993d10f 100644 --- a/internal/mocks/logging.go +++ b/internal/mocks/connection_tracer.go @@ -1,5 +1,5 @@ // 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 @@ -16,277 +16,277 @@ import ( logging "github.com/lucas-clemente/quic-go/logging" ) -// MockTracer is a mock of Tracer interface -type MockTracer struct { +// MockConnectionTracer is a mock of ConnectionTracer interface +type MockConnectionTracer struct { ctrl *gomock.Controller - recorder *MockTracerMockRecorder + recorder *MockConnectionTracerMockRecorder } -// MockTracerMockRecorder is the mock recorder for MockTracer -type MockTracerMockRecorder struct { - mock *MockTracer +// MockConnectionTracerMockRecorder is the mock recorder for MockConnectionTracer +type MockConnectionTracerMockRecorder struct { + mock *MockConnectionTracer } -// NewMockTracer creates a new mock instance -func NewMockTracer(ctrl *gomock.Controller) *MockTracer { - mock := &MockTracer{ctrl: ctrl} - mock.recorder = &MockTracerMockRecorder{mock} +// NewMockConnectionTracer creates a new mock instance +func NewMockConnectionTracer(ctrl *gomock.Controller) *MockConnectionTracer { + mock := &MockConnectionTracer{ctrl: ctrl} + mock.recorder = &MockConnectionTracerMockRecorder{mock} return mock } // 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 } // BufferedPacket mocks base method -func (m *MockTracer) BufferedPacket(arg0 logging.PacketType) { +func (m *MockConnectionTracer) BufferedPacket(arg0 logging.PacketType) { m.ctrl.T.Helper() m.ctrl.Call(m, "BufferedPacket", arg0) } // 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() - 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 -func (m *MockTracer) Close() { +func (m *MockConnectionTracer) Close() { m.ctrl.T.Helper() m.ctrl.Call(m, "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() - 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 -func (m *MockTracer) ClosedConnection(arg0 logging.CloseReason) { +func (m *MockConnectionTracer) ClosedConnection(arg0 logging.CloseReason) { m.ctrl.T.Helper() m.ctrl.Call(m, "ClosedConnection", arg0) } // 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() - 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 -func (m *MockTracer) DroppedEncryptionLevel(arg0 protocol.EncryptionLevel) { +func (m *MockConnectionTracer) DroppedEncryptionLevel(arg0 protocol.EncryptionLevel) { m.ctrl.T.Helper() m.ctrl.Call(m, "DroppedEncryptionLevel", arg0) } // 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() - 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 -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.Call(m, "DroppedPacket", arg0, arg1, arg2) } // 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() - 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 -func (m *MockTracer) LossTimerCanceled() { +func (m *MockConnectionTracer) LossTimerCanceled() { m.ctrl.T.Helper() m.ctrl.Call(m, "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() - 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 -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.Call(m, "LossTimerExpired", arg0, arg1) } // 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() - 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 -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.Call(m, "LostPacket", arg0, arg1, arg2) } // 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() - 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 -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.Call(m, "ReceivedPacket", arg0, arg1, arg2) } // 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() - 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 -func (m *MockTracer) ReceivedRetry(arg0 *wire.Header) { +func (m *MockConnectionTracer) ReceivedRetry(arg0 *wire.Header) { m.ctrl.T.Helper() m.ctrl.Call(m, "ReceivedRetry", arg0) } // 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() - 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 -func (m *MockTracer) ReceivedStatelessReset(arg0 *[16]byte) { +func (m *MockConnectionTracer) ReceivedStatelessReset(arg0 *[16]byte) { m.ctrl.T.Helper() m.ctrl.Call(m, "ReceivedStatelessReset", arg0) } // 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() - 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 -func (m *MockTracer) ReceivedTransportParameters(arg0 *wire.TransportParameters) { +func (m *MockConnectionTracer) ReceivedTransportParameters(arg0 *wire.TransportParameters) { m.ctrl.T.Helper() m.ctrl.Call(m, "ReceivedTransportParameters", arg0) } // 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() - 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 -func (m *MockTracer) ReceivedVersionNegotiationPacket(arg0 *wire.Header) { +func (m *MockConnectionTracer) ReceivedVersionNegotiationPacket(arg0 *wire.Header) { m.ctrl.T.Helper() m.ctrl.Call(m, "ReceivedVersionNegotiationPacket", arg0) } // 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() - 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 -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.Call(m, "SentPacket", arg0, arg1, arg2, arg3) } // 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() - 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 -func (m *MockTracer) SentTransportParameters(arg0 *wire.TransportParameters) { +func (m *MockConnectionTracer) SentTransportParameters(arg0 *wire.TransportParameters) { m.ctrl.T.Helper() m.ctrl.Call(m, "SentTransportParameters", arg0) } // 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() - 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 -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.Call(m, "SetLossTimer", arg0, arg1, arg2) } // 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() - 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 -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.Call(m, "StartedConnection", arg0, arg1, arg2, arg3, arg4) } // 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() - 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 -func (m *MockTracer) UpdatedKey(arg0 protocol.KeyPhase, arg1 bool) { +func (m *MockConnectionTracer) UpdatedKey(arg0 protocol.KeyPhase, arg1 bool) { m.ctrl.T.Helper() m.ctrl.Call(m, "UpdatedKey", arg0, arg1) } // 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() - 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 -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.Call(m, "UpdatedKeyFromTLS", arg0, arg1) } // 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() - 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 -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.Call(m, "UpdatedMetrics", arg0, arg1, arg2, arg3) } // 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() - 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 -func (m *MockTracer) UpdatedPTOCount(arg0 uint32) { +func (m *MockConnectionTracer) UpdatedPTOCount(arg0 uint32) { m.ctrl.T.Helper() m.ctrl.Call(m, "UpdatedPTOCount", arg0) } // 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() - 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) } diff --git a/internal/mocks/mockgen.go b/internal/mocks/mockgen.go index dc7524d1..5e949429 100644 --- a/internal/mocks/mockgen.go +++ b/internal/mocks/mockgen.go @@ -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/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 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_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" diff --git a/logging/interface.go b/logging/interface.go index 4df9cb59..9d38b162 100644 --- a/logging/interface.go +++ b/logging/interface.go @@ -11,8 +11,8 @@ import ( "github.com/lucas-clemente/quic-go/internal/wire" ) -// A Tracer records events. -type Tracer interface { +// A ConnectionTracer records events. +type ConnectionTracer interface { StartedConnection(local, remote net.Addr, version protocol.VersionNumber, srcConnID, destConnID protocol.ConnectionID) ClosedConnection(CloseReason) SentTransportParameters(*wire.TransportParameters) diff --git a/qlog/qlog.go b/qlog/qlog.go index d7eb907d..e3e809f2 100644 --- a/qlog/qlog.go +++ b/qlog/qlog.go @@ -19,7 +19,7 @@ import ( const eventChanSize = 50 -type tracer struct { +type connectionTracer struct { mutex sync.Mutex w io.WriteCloser @@ -35,11 +35,11 @@ type tracer struct { lastMetrics *metrics } -var _ logging.Tracer = &tracer{} +var _ logging.ConnectionTracer = &connectionTracer{} -// NewTracer creates a new tracer to record a qlog. -func NewTracer(w io.WriteCloser, p protocol.Perspective, odcid protocol.ConnectionID) logging.Tracer { - t := &tracer{ +// NewTracer creates a new connectionTracer to record a qlog. +func NewTracer(w io.WriteCloser, p protocol.Perspective, odcid protocol.ConnectionID) logging.ConnectionTracer { + t := &connectionTracer{ w: w, perspective: p, odcid: odcid, @@ -51,7 +51,7 @@ func NewTracer(w io.WriteCloser, p protocol.Perspective, odcid protocol.Connecti return t } -func (t *tracer) run() { +func (t *connectionTracer) run() { defer close(t.runStopped) buf := &bytes.Buffer{} 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 { log.Printf("exporting qlog failed: %s\n", err) } } // export writes a qlog. -func (t *tracer) export() error { +func (t *connectionTracer) export() error { close(t.events) <-t.runStopped if t.encodeErr != nil { @@ -110,14 +110,14 @@ func (t *tracer) export() error { 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{ RelativeTime: eventTime.Sub(t.referenceTime), 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 localAddr, ok := local.(*net.UDPAddr) if !ok { @@ -138,21 +138,21 @@ func (t *tracer) StartedConnection(local, remote net.Addr, version protocol.Vers t.mutex.Unlock() } -func (t *tracer) ClosedConnection(r logging.CloseReason) { +func (t *connectionTracer) ClosedConnection(r logging.CloseReason) { t.mutex.Lock() t.recordEvent(time.Now(), &eventConnectionClosed{Reason: r}) t.mutex.Unlock() } -func (t *tracer) SentTransportParameters(tp *wire.TransportParameters) { +func (t *connectionTracer) SentTransportParameters(tp *wire.TransportParameters) { 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) } -func (t *tracer) recordTransportParameters(sentBy protocol.Perspective, tp *wire.TransportParameters) { +func (t *connectionTracer) recordTransportParameters(sentBy protocol.Perspective, tp *wire.TransportParameters) { owner := ownerLocal if sentBy != t.perspective { owner = ownerRemote @@ -181,7 +181,7 @@ func (t *tracer) recordTransportParameters(sentBy protocol.Perspective, tp *wire 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) if ack != nil { numFrames++ @@ -204,7 +204,7 @@ func (t *tracer) SentPacket(hdr *wire.ExtendedHeader, packetSize protocol.ByteCo 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)) for i, f := range frames { fs[i] = *transformFrame(f) @@ -220,7 +220,7 @@ func (t *tracer) ReceivedPacket(hdr *wire.ExtendedHeader, packetSize protocol.By t.mutex.Unlock() } -func (t *tracer) ReceivedRetry(hdr *wire.Header) { +func (t *connectionTracer) ReceivedRetry(hdr *wire.Header) { t.mutex.Lock() t.recordEvent(time.Now(), &eventRetryReceived{ Header: *transformHeader(hdr), @@ -228,7 +228,7 @@ func (t *tracer) ReceivedRetry(hdr *wire.Header) { t.mutex.Unlock() } -func (t *tracer) ReceivedVersionNegotiationPacket(hdr *wire.Header) { +func (t *connectionTracer) ReceivedVersionNegotiationPacket(hdr *wire.Header) { versions := make([]versionNumber, len(hdr.SupportedVersions)) for i, v := range hdr.SupportedVersions { versions[i] = versionNumber(v) @@ -241,7 +241,7 @@ func (t *tracer) ReceivedVersionNegotiationPacket(hdr *wire.Header) { t.mutex.Unlock() } -func (t *tracer) ReceivedStatelessReset(token *[16]byte) { +func (t *connectionTracer) ReceivedStatelessReset(token *[16]byte) { t.mutex.Lock() t.recordEvent(time.Now(), &eventStatelessResetReceived{ Token: token, @@ -249,13 +249,13 @@ func (t *tracer) ReceivedStatelessReset(token *[16]byte) { t.mutex.Unlock() } -func (t *tracer) BufferedPacket(packetType logging.PacketType) { +func (t *connectionTracer) BufferedPacket(packetType logging.PacketType) { t.mutex.Lock() t.recordEvent(time.Now(), &eventPacketBuffered{PacketType: packetType}) 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.recordEvent(time.Now(), &eventPacketDropped{ PacketType: packetType, @@ -265,7 +265,7 @@ func (t *tracer) DroppedPacket(packetType logging.PacketType, size protocol.Byte 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{ MinRTT: rttStats.MinRTT(), SmoothedRTT: rttStats.SmoothedRTT(), @@ -284,7 +284,7 @@ func (t *tracer) UpdatedMetrics(rttStats *congestion.RTTStats, cwnd, bytesInFlig 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.recordEvent(time.Now(), &eventPacketLost{ PacketType: getPacketTypeFromEncryptionLevel(encLevel), @@ -294,13 +294,13 @@ func (t *tracer) LostPacket(encLevel protocol.EncryptionLevel, pn protocol.Packe t.mutex.Unlock() } -func (t *tracer) UpdatedPTOCount(value uint32) { +func (t *connectionTracer) UpdatedPTOCount(value uint32) { t.mutex.Lock() t.recordEvent(time.Now(), &eventUpdatedPTO{Value: value}) 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.recordEvent(time.Now(), &eventKeyUpdated{ Trigger: keyUpdateTLS, @@ -309,7 +309,7 @@ func (t *tracer) UpdatedKeyFromTLS(encLevel protocol.EncryptionLevel, pers proto t.mutex.Unlock() } -func (t *tracer) UpdatedKey(generation protocol.KeyPhase, remote bool) { +func (t *connectionTracer) UpdatedKey(generation protocol.KeyPhase, remote bool) { trigger := keyUpdateLocal if remote { trigger = keyUpdateRemote @@ -329,7 +329,7 @@ func (t *tracer) UpdatedKey(generation protocol.KeyPhase, remote bool) { t.mutex.Unlock() } -func (t *tracer) DroppedEncryptionLevel(encLevel protocol.EncryptionLevel) { +func (t *connectionTracer) DroppedEncryptionLevel(encLevel protocol.EncryptionLevel) { t.mutex.Lock() now := time.Now() t.recordEvent(now, &eventKeyRetired{KeyType: encLevelToKeyType(encLevel, protocol.PerspectiveServer)}) @@ -337,7 +337,7 @@ func (t *tracer) DroppedEncryptionLevel(encLevel protocol.EncryptionLevel) { 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() now := time.Now() t.recordEvent(now, &eventLossTimerSet{ @@ -348,7 +348,7 @@ func (t *tracer) SetLossTimer(tt logging.TimerType, encLevel protocol.Encryption 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.recordEvent(time.Now(), &eventLossTimerExpired{ TimerType: tt, @@ -357,7 +357,7 @@ func (t *tracer) LossTimerExpired(tt logging.TimerType, encLevel protocol.Encryp t.mutex.Unlock() } -func (t *tracer) LossTimerCanceled() { +func (t *connectionTracer) LossTimerCanceled() { t.mutex.Lock() t.recordEvent(time.Now(), &eventLossTimerCanceled{}) t.mutex.Unlock() diff --git a/qlog/qlog_test.go b/qlog/qlog_test.go index 4960ce80..a95c870e 100644 --- a/qlog/qlog_test.go +++ b/qlog/qlog_test.go @@ -51,7 +51,7 @@ type entry struct { var _ = Describe("Tracer", func() { var ( - tracer logging.Tracer + tracer logging.ConnectionTracer buf *bytes.Buffer ) diff --git a/server.go b/server.go index 82c69727..a16ebe4f 100644 --- a/server.go +++ b/server.go @@ -87,7 +87,7 @@ type baseServer struct { *tls.Config, *handshake.TokenGenerator, bool, /* enable 0-RTT */ - logging.Tracer, + logging.ConnectionTracer, utils.Logger, protocol.VersionNumber, ) quicSession @@ -447,7 +447,7 @@ func (s *baseServer) createNewSession( ) quicSession { var sess quicSession if added := s.sessionHandler.AddWithConnID(clientDestConnID, srcConnID, func() packetHandler { - var tracer logging.Tracer + var tracer logging.ConnectionTracer if s.config.GetLogWriter != nil { // Use the same connection ID that is passed to the client's GetLogWriter callback. connID := clientDestConnID diff --git a/server_test.go b/server_test.go index 5620a070..01d7f122 100644 --- a/server_test.go +++ b/server_test.go @@ -335,7 +335,7 @@ var _ = Describe("Server", func() { _ *tls.Config, _ *handshake.TokenGenerator, enable0RTT bool, - _ logging.Tracer, + _ logging.ConnectionTracer, _ utils.Logger, _ protocol.VersionNumber, ) quicSession { @@ -508,7 +508,7 @@ var _ = Describe("Server", func() { _ *tls.Config, _ *handshake.TokenGenerator, enable0RTT bool, - _ logging.Tracer, + _ logging.ConnectionTracer, _ utils.Logger, _ protocol.VersionNumber, ) quicSession { @@ -575,7 +575,7 @@ var _ = Describe("Server", func() { _ *tls.Config, _ *handshake.TokenGenerator, _ bool, - _ logging.Tracer, + _ logging.ConnectionTracer, _ utils.Logger, _ protocol.VersionNumber, ) quicSession { @@ -618,7 +618,7 @@ var _ = Describe("Server", func() { _ *tls.Config, _ *handshake.TokenGenerator, _ bool, - _ logging.Tracer, + _ logging.ConnectionTracer, _ utils.Logger, _ protocol.VersionNumber, ) quicSession { @@ -666,7 +666,7 @@ var _ = Describe("Server", func() { _ *tls.Config, _ *handshake.TokenGenerator, _ bool, - _ logging.Tracer, + _ logging.ConnectionTracer, _ utils.Logger, _ protocol.VersionNumber, ) quicSession { @@ -696,7 +696,7 @@ var _ = Describe("Server", func() { _ *tls.Config, _ *handshake.TokenGenerator, _ bool, - _ logging.Tracer, + _ logging.ConnectionTracer, _ utils.Logger, _ protocol.VersionNumber, ) quicSession { @@ -761,7 +761,7 @@ var _ = Describe("Server", func() { _ *tls.Config, _ *handshake.TokenGenerator, _ bool, - _ logging.Tracer, + _ logging.ConnectionTracer, _ utils.Logger, _ protocol.VersionNumber, ) quicSession { @@ -869,7 +869,7 @@ var _ = Describe("Server", func() { _ *tls.Config, _ *handshake.TokenGenerator, _ bool, - _ logging.Tracer, + _ logging.ConnectionTracer, _ utils.Logger, _ protocol.VersionNumber, ) quicSession { @@ -936,7 +936,7 @@ var _ = Describe("Server", func() { _ *tls.Config, _ *handshake.TokenGenerator, enable0RTT bool, - _ logging.Tracer, + _ logging.ConnectionTracer, _ utils.Logger, _ protocol.VersionNumber, ) quicSession { @@ -974,7 +974,7 @@ var _ = Describe("Server", func() { _ *tls.Config, _ *handshake.TokenGenerator, _ bool, - _ logging.Tracer, + _ logging.ConnectionTracer, _ utils.Logger, _ protocol.VersionNumber, ) quicSession { @@ -1033,7 +1033,7 @@ var _ = Describe("Server", func() { _ *tls.Config, _ *handshake.TokenGenerator, _ bool, - _ logging.Tracer, + _ logging.ConnectionTracer, _ utils.Logger, _ protocol.VersionNumber, ) quicSession { diff --git a/session.go b/session.go index c2cbfa69..acbb2cee 100644 --- a/session.go +++ b/session.go @@ -204,7 +204,7 @@ type session struct { traceCallback func(quictrace.Event) logID string - tracer logging.Tracer + tracer logging.ConnectionTracer logger utils.Logger } @@ -225,7 +225,7 @@ var newSession = func( tlsConf *tls.Config, tokenGenerator *handshake.TokenGenerator, enable0RTT bool, - tracer logging.Tracer, + tracer logging.ConnectionTracer, logger utils.Logger, v protocol.VersionNumber, ) quicSession { @@ -350,7 +350,7 @@ var newClientSession = func( initialVersion protocol.VersionNumber, enable0RTT bool, hasNegotiatedVersion bool, - tracer logging.Tracer, + tracer logging.ConnectionTracer, logger utils.Logger, v protocol.VersionNumber, ) quicSession { diff --git a/session_test.go b/session_test.go index eac9c26c..1176698c 100644 --- a/session_test.go +++ b/session_test.go @@ -49,7 +49,7 @@ var _ = Describe("Session", func() { streamManager *MockStreamManager packer *MockPacker cryptoSetup *mocks.MockCryptoSetup - tracer *mocks.MockTracer + tracer *mocks.MockConnectionTracer ) remoteAddr := &net.UDPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 1337} 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() tokenGenerator, err := handshake.NewTokenGenerator() Expect(err).ToNot(HaveOccurred()) - tracer = mocks.NewMockTracer(mockCtrl) + tracer = mocks.NewMockConnectionTracer(mockCtrl) tracer.EXPECT().SentTransportParameters(gomock.Any()) tracer.EXPECT().UpdatedKeyFromTLS(gomock.Any(), gomock.Any()).AnyTimes() sess = newSession( @@ -1981,7 +1981,7 @@ var _ = Describe("Client Session", func() { packer *MockPacker mconn *MockConnection cryptoSetup *mocks.MockCryptoSetup - tracer *mocks.MockTracer + tracer *mocks.MockConnectionTracer tlsConf *tls.Config quicConf *Config ) @@ -2020,7 +2020,7 @@ var _ = Describe("Client Session", func() { tlsConf = &tls.Config{} } sessionRunner = NewMockSessionRunner(mockCtrl) - tracer = mocks.NewMockTracer(mockCtrl) + tracer = mocks.NewMockConnectionTracer(mockCtrl) tracer.EXPECT().SentTransportParameters(gomock.Any()) tracer.EXPECT().UpdatedKeyFromTLS(gomock.Any(), gomock.Any()).AnyTimes() sess = newClientSession(