From c9a2f79b1c35443e0fa2ab3ec9d3938e9185c1c2 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Wed, 19 Apr 2023 16:57:00 +0200 Subject: [PATCH] simplify mockgen usage for private interfaces (#3769) --- client_test.go | 20 +-- connection_test.go | 2 +- http3/mock_roundtripcloser_test.go | 2 +- http3/mockgen.go | 6 + http3/roundtrip_test.go | 2 - .../mock_sent_packet_tracker_test.go | 2 +- internal/ackhandler/mockgen.go | 5 +- .../handshake/mock_handshake_runner_test.go | 2 +- internal/handshake/mockgen.go | 5 +- mock_ack_frame_source_test.go | 10 +- mock_batch_conn_test.go | 2 +- mock_conn_runner_test.go | 2 +- mock_crypto_data_handler_test.go | 2 +- mock_crypto_stream_test.go | 10 +- mock_frame_source_test.go | 2 +- mock_mtu_discoverer_test.go | 38 ++--- mock_multiplexer_test.go | 10 +- mock_packer_test.go | 26 +-- mock_packet_handler_manager_test.go | 2 +- mock_packet_handler_test.go | 2 +- mock_quic_conn_test.go | 157 +++++++++--------- mock_receive_stream_internal_test.go | 25 +-- mock_sealing_manager_test.go | 2 +- mock_send_conn_test.go | 2 +- mock_send_stream_internal_test.go | 33 ++-- mock_sender_test.go | 10 +- mock_stream_getter_test.go | 2 +- mock_stream_internal_test.go | 59 +++---- mock_stream_manager_test.go | 2 +- mock_stream_sender_test.go | 2 +- mock_unknown_packet_handler_test.go | 2 +- mock_unpacker_test.go | 18 +- mockgen.go | 100 ++++++++--- mockgen_private.sh | 49 ------ server_test.go | 20 +-- 35 files changed, 325 insertions(+), 310 deletions(-) create mode 100644 http3/mockgen.go delete mode 100755 mockgen_private.sh diff --git a/client_test.go b/client_test.go index c34f55e5..d2968523 100644 --- a/client_test.go +++ b/client_test.go @@ -123,7 +123,7 @@ var _ = Describe("Client", func() { _ protocol.VersionNumber, ) quicConn { remoteAddrChan <- sconn.RemoteAddr().String() - conn := NewMockQuicConn(mockCtrl) + conn := NewMockQUICConn(mockCtrl) conn.EXPECT().run() conn.EXPECT().HandshakeComplete().Return(make(chan struct{})) return conn @@ -156,7 +156,7 @@ var _ = Describe("Client", func() { _ protocol.VersionNumber, ) quicConn { hostnameChan <- tlsConf.ServerName - conn := NewMockQuicConn(mockCtrl) + conn := NewMockQUICConn(mockCtrl) conn.EXPECT().run() conn.EXPECT().HandshakeComplete().Return(make(chan struct{})) return conn @@ -189,7 +189,7 @@ var _ = Describe("Client", func() { _ protocol.VersionNumber, ) quicConn { hostnameChan <- tlsConf.ServerName - conn := NewMockQuicConn(mockCtrl) + conn := NewMockQUICConn(mockCtrl) conn.EXPECT().HandshakeComplete().Return(make(chan struct{})) conn.EXPECT().run() return conn @@ -228,7 +228,7 @@ var _ = Describe("Client", func() { _ protocol.VersionNumber, ) quicConn { Expect(enable0RTT).To(BeFalse()) - conn := NewMockQuicConn(mockCtrl) + conn := NewMockQUICConn(mockCtrl) conn.EXPECT().run().Do(func() { close(run) }) c := make(chan struct{}) close(c) @@ -271,7 +271,7 @@ var _ = Describe("Client", func() { _ protocol.VersionNumber, ) quicConn { Expect(enable0RTT).To(BeTrue()) - conn := NewMockQuicConn(mockCtrl) + conn := NewMockQUICConn(mockCtrl) conn.EXPECT().run().Do(func() { <-done }) conn.EXPECT().HandshakeComplete().Return(make(chan struct{})) conn.EXPECT().earlyConnReady().Return(readyChan) @@ -318,7 +318,7 @@ var _ = Describe("Client", func() { _ utils.Logger, _ protocol.VersionNumber, ) quicConn { - conn := NewMockQuicConn(mockCtrl) + conn := NewMockQUICConn(mockCtrl) conn.EXPECT().run().Return(testErr) conn.EXPECT().HandshakeComplete().Return(make(chan struct{})) return conn @@ -341,7 +341,7 @@ var _ = Describe("Client", func() { connRunning := make(chan struct{}) defer close(connRunning) - conn := NewMockQuicConn(mockCtrl) + conn := NewMockQUICConn(mockCtrl) conn.EXPECT().run().Do(func() { <-connRunning }) @@ -393,7 +393,7 @@ var _ = Describe("Client", func() { var sconn sendConn run := make(chan struct{}) connCreated := make(chan struct{}) - conn := NewMockQuicConn(mockCtrl) + conn := NewMockQUICConn(mockCtrl) newClientConnection = func( connP sendConn, _ connRunner, @@ -535,7 +535,7 @@ var _ = Describe("Client", func() { conf = configP close(c) // TODO: check connection IDs? - conn := NewMockQuicConn(mockCtrl) + conn := NewMockQUICConn(mockCtrl) conn.EXPECT().run() conn.EXPECT().HandshakeComplete().Return(make(chan struct{})) return conn @@ -570,7 +570,7 @@ var _ = Describe("Client", func() { _ utils.Logger, versionP protocol.VersionNumber, ) quicConn { - conn := NewMockQuicConn(mockCtrl) + conn := NewMockQUICConn(mockCtrl) conn.EXPECT().HandshakeComplete().Return(make(chan struct{})) if counter == 0 { Expect(pn).To(BeZero()) diff --git a/connection_test.go b/connection_test.go index 370c8974..a2829e85 100644 --- a/connection_test.go +++ b/connection_test.go @@ -1631,7 +1631,7 @@ var _ = Describe("Connection", func() { }) It("sends a Path MTU probe packet", func() { - mtuDiscoverer := NewMockMtuDiscoverer(mockCtrl) + mtuDiscoverer := NewMockMTUDiscoverer(mockCtrl) conn.mtuDiscoverer = mtuDiscoverer conn.config.DisablePathMTUDiscovery = false sph.EXPECT().SentPacket(gomock.Any()) diff --git a/http3/mock_roundtripcloser_test.go b/http3/mock_roundtripcloser_test.go index ce409a75..7aa19ee3 100644 --- a/http3/mock_roundtripcloser_test.go +++ b/http3/mock_roundtripcloser_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: roundtrip.go +// Source: github.com/quic-go/quic-go/http3 (interfaces: RoundTripCloser) // Package http3 is a generated GoMock package. package http3 diff --git a/http3/mockgen.go b/http3/mockgen.go new file mode 100644 index 00000000..cb370373 --- /dev/null +++ b/http3/mockgen.go @@ -0,0 +1,6 @@ +//go:build gomock || generate + +package http3 + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package http3 -destination mock_roundtripcloser_test.go github.com/quic-go/quic-go/http3 RoundTripCloser" +type RoundTripCloser = roundTripCloser diff --git a/http3/roundtrip_test.go b/http3/roundtrip_test.go index 26c46ec2..bd44610b 100644 --- a/http3/roundtrip_test.go +++ b/http3/roundtrip_test.go @@ -19,8 +19,6 @@ import ( . "github.com/onsi/gomega" ) -//go:generate sh -c "./../mockgen_private.sh http3 mock_roundtripcloser_test.go github.com/quic-go/quic-go/http3 roundTripCloser" - type mockBody struct { reader bytes.Reader readErr error diff --git a/internal/ackhandler/mock_sent_packet_tracker_test.go b/internal/ackhandler/mock_sent_packet_tracker_test.go index e60f674f..83c28fd5 100644 --- a/internal/ackhandler/mock_sent_packet_tracker_test.go +++ b/internal/ackhandler/mock_sent_packet_tracker_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: interfaces.go +// Source: github.com/quic-go/quic-go/internal/ackhandler (interfaces: SentPacketTracker) // Package ackhandler is a generated GoMock package. package ackhandler diff --git a/internal/ackhandler/mockgen.go b/internal/ackhandler/mockgen.go index 366e5520..d6178367 100644 --- a/internal/ackhandler/mockgen.go +++ b/internal/ackhandler/mockgen.go @@ -1,3 +1,6 @@ +//go:build gomock || generate + package ackhandler -//go:generate sh -c "../../mockgen_private.sh ackhandler mock_sent_packet_tracker_test.go github.com/quic-go/quic-go/internal/ackhandler sentPacketTracker" +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package ackhandler -destination mock_sent_packet_tracker_test.go github.com/quic-go/quic-go/internal/ackhandler SentPacketTracker" +type SentPacketTracker = sentPacketTracker diff --git a/internal/handshake/mock_handshake_runner_test.go b/internal/handshake/mock_handshake_runner_test.go index 0b6a8ef4..fa8decbe 100644 --- a/internal/handshake/mock_handshake_runner_test.go +++ b/internal/handshake/mock_handshake_runner_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: interface.go +// Source: github.com/quic-go/quic-go/internal/handshake (interfaces: HandshakeRunner) // Package handshake is a generated GoMock package. package handshake diff --git a/internal/handshake/mockgen.go b/internal/handshake/mockgen.go index f91e7e8a..68b0988c 100644 --- a/internal/handshake/mockgen.go +++ b/internal/handshake/mockgen.go @@ -1,3 +1,6 @@ +//go:build gomock || generate + package handshake -//go:generate sh -c "../../mockgen_private.sh handshake mock_handshake_runner_test.go github.com/quic-go/quic-go/internal/handshake handshakeRunner" +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package handshake -destination mock_handshake_runner_test.go github.com/quic-go/quic-go/internal/handshake HandshakeRunner" +type HandshakeRunner = handshakeRunner diff --git a/mock_ack_frame_source_test.go b/mock_ack_frame_source_test.go index dc2085ed..1284752b 100644 --- a/mock_ack_frame_source_test.go +++ b/mock_ack_frame_source_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: packet_packer.go +// Source: github.com/quic-go/quic-go (interfaces: AckFrameSource) // Package quic is a generated GoMock package. package quic @@ -36,15 +36,15 @@ func (m *MockAckFrameSource) EXPECT() *MockAckFrameSourceMockRecorder { } // GetAckFrame mocks base method. -func (m *MockAckFrameSource) GetAckFrame(encLevel protocol.EncryptionLevel, onlyIfQueued bool) *wire.AckFrame { +func (m *MockAckFrameSource) GetAckFrame(arg0 protocol.EncryptionLevel, arg1 bool) *wire.AckFrame { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAckFrame", encLevel, onlyIfQueued) + ret := m.ctrl.Call(m, "GetAckFrame", arg0, arg1) ret0, _ := ret[0].(*wire.AckFrame) return ret0 } // GetAckFrame indicates an expected call of GetAckFrame. -func (mr *MockAckFrameSourceMockRecorder) GetAckFrame(encLevel, onlyIfQueued interface{}) *gomock.Call { +func (mr *MockAckFrameSourceMockRecorder) GetAckFrame(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAckFrame", reflect.TypeOf((*MockAckFrameSource)(nil).GetAckFrame), encLevel, onlyIfQueued) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAckFrame", reflect.TypeOf((*MockAckFrameSource)(nil).GetAckFrame), arg0, arg1) } diff --git a/mock_batch_conn_test.go b/mock_batch_conn_test.go index 74032900..fcb23e34 100644 --- a/mock_batch_conn_test.go +++ b/mock_batch_conn_test.go @@ -11,7 +11,7 @@ import ( ipv4 "golang.org/x/net/ipv4" ) -// MockBatchConn is a mock of BatchConn interface. +// MockBatchConn is a mock of batchConn interface. type MockBatchConn struct { ctrl *gomock.Controller recorder *MockBatchConnMockRecorder diff --git a/mock_conn_runner_test.go b/mock_conn_runner_test.go index a09e79bc..ec587323 100644 --- a/mock_conn_runner_test.go +++ b/mock_conn_runner_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: connection.go +// Source: github.com/quic-go/quic-go (interfaces: ConnRunner) // Package quic is a generated GoMock package. package quic diff --git a/mock_crypto_data_handler_test.go b/mock_crypto_data_handler_test.go index 6bc98da9..47deb442 100644 --- a/mock_crypto_data_handler_test.go +++ b/mock_crypto_data_handler_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: crypto_stream_manager.go +// Source: github.com/quic-go/quic-go (interfaces: CryptoDataHandler) // Package quic is a generated GoMock package. package quic diff --git a/mock_crypto_stream_test.go b/mock_crypto_stream_test.go index 9c72bdb5..c2048fa8 100644 --- a/mock_crypto_stream_test.go +++ b/mock_crypto_stream_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: crypto_stream.go +// Source: github.com/quic-go/quic-go (interfaces: CryptoStream) // Package quic is a generated GoMock package. package quic @@ -106,16 +106,16 @@ func (mr *MockCryptoStreamMockRecorder) PopCryptoFrame(arg0 interface{}) *gomock } // Write mocks base method. -func (m *MockCryptoStream) Write(p []byte) (int, error) { +func (m *MockCryptoStream) Write(arg0 []byte) (int, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Write", p) + ret := m.ctrl.Call(m, "Write", arg0) ret0, _ := ret[0].(int) ret1, _ := ret[1].(error) return ret0, ret1 } // Write indicates an expected call of Write. -func (mr *MockCryptoStreamMockRecorder) Write(p interface{}) *gomock.Call { +func (mr *MockCryptoStreamMockRecorder) Write(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockCryptoStream)(nil).Write), p) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockCryptoStream)(nil).Write), arg0) } diff --git a/mock_frame_source_test.go b/mock_frame_source_test.go index ec3d2734..fde92852 100644 --- a/mock_frame_source_test.go +++ b/mock_frame_source_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: packet_packer.go +// Source: github.com/quic-go/quic-go (interfaces: FrameSource) // Package quic is a generated GoMock package. package quic diff --git a/mock_mtu_discoverer_test.go b/mock_mtu_discoverer_test.go index da864a30..a59fc3fe 100644 --- a/mock_mtu_discoverer_test.go +++ b/mock_mtu_discoverer_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: mtu_discoverer.go +// Source: github.com/quic-go/quic-go (interfaces: MTUDiscoverer) // Package quic is a generated GoMock package. package quic @@ -13,31 +13,31 @@ import ( protocol "github.com/quic-go/quic-go/internal/protocol" ) -// MockMtuDiscoverer is a mock of MtuDiscoverer interface. -type MockMtuDiscoverer struct { +// MockMTUDiscoverer is a mock of MTUDiscoverer interface. +type MockMTUDiscoverer struct { ctrl *gomock.Controller - recorder *MockMtuDiscovererMockRecorder + recorder *MockMTUDiscovererMockRecorder } -// MockMtuDiscovererMockRecorder is the mock recorder for MockMtuDiscoverer. -type MockMtuDiscovererMockRecorder struct { - mock *MockMtuDiscoverer +// MockMTUDiscovererMockRecorder is the mock recorder for MockMTUDiscoverer. +type MockMTUDiscovererMockRecorder struct { + mock *MockMTUDiscoverer } -// NewMockMtuDiscoverer creates a new mock instance. -func NewMockMtuDiscoverer(ctrl *gomock.Controller) *MockMtuDiscoverer { - mock := &MockMtuDiscoverer{ctrl: ctrl} - mock.recorder = &MockMtuDiscovererMockRecorder{mock} +// NewMockMTUDiscoverer creates a new mock instance. +func NewMockMTUDiscoverer(ctrl *gomock.Controller) *MockMTUDiscoverer { + mock := &MockMTUDiscoverer{ctrl: ctrl} + mock.recorder = &MockMTUDiscovererMockRecorder{mock} return mock } // EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockMtuDiscoverer) EXPECT() *MockMtuDiscovererMockRecorder { +func (m *MockMTUDiscoverer) EXPECT() *MockMTUDiscovererMockRecorder { return m.recorder } // GetPing mocks base method. -func (m *MockMtuDiscoverer) GetPing() (ackhandler.Frame, protocol.ByteCount) { +func (m *MockMTUDiscoverer) GetPing() (ackhandler.Frame, protocol.ByteCount) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetPing") ret0, _ := ret[0].(ackhandler.Frame) @@ -46,21 +46,21 @@ func (m *MockMtuDiscoverer) GetPing() (ackhandler.Frame, protocol.ByteCount) { } // GetPing indicates an expected call of GetPing. -func (mr *MockMtuDiscovererMockRecorder) GetPing() *gomock.Call { +func (mr *MockMTUDiscovererMockRecorder) GetPing() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPing", reflect.TypeOf((*MockMtuDiscoverer)(nil).GetPing)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetPing", reflect.TypeOf((*MockMTUDiscoverer)(nil).GetPing)) } // ShouldSendProbe mocks base method. -func (m *MockMtuDiscoverer) ShouldSendProbe(now time.Time) bool { +func (m *MockMTUDiscoverer) ShouldSendProbe(arg0 time.Time) bool { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ShouldSendProbe", now) + ret := m.ctrl.Call(m, "ShouldSendProbe", arg0) ret0, _ := ret[0].(bool) return ret0 } // ShouldSendProbe indicates an expected call of ShouldSendProbe. -func (mr *MockMtuDiscovererMockRecorder) ShouldSendProbe(now interface{}) *gomock.Call { +func (mr *MockMTUDiscovererMockRecorder) ShouldSendProbe(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ShouldSendProbe", reflect.TypeOf((*MockMtuDiscoverer)(nil).ShouldSendProbe), now) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ShouldSendProbe", reflect.TypeOf((*MockMTUDiscoverer)(nil).ShouldSendProbe), arg0) } diff --git a/mock_multiplexer_test.go b/mock_multiplexer_test.go index d4364364..0383b1a4 100644 --- a/mock_multiplexer_test.go +++ b/mock_multiplexer_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: multiplexer.go +// Source: github.com/quic-go/quic-go (interfaces: Multiplexer) // Package quic is a generated GoMock package. package quic @@ -36,18 +36,18 @@ func (m *MockMultiplexer) EXPECT() *MockMultiplexerMockRecorder { } // AddConn mocks base method. -func (m *MockMultiplexer) AddConn(c net.PacketConn, connIDLen int, statelessResetKey *StatelessResetKey, tracer logging.Tracer) (packetHandlerManager, error) { +func (m *MockMultiplexer) AddConn(arg0 net.PacketConn, arg1 int, arg2 *StatelessResetKey, arg3 logging.Tracer) (packetHandlerManager, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "AddConn", c, connIDLen, statelessResetKey, tracer) + ret := m.ctrl.Call(m, "AddConn", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(packetHandlerManager) ret1, _ := ret[1].(error) return ret0, ret1 } // AddConn indicates an expected call of AddConn. -func (mr *MockMultiplexerMockRecorder) AddConn(c, connIDLen, statelessResetKey, tracer interface{}) *gomock.Call { +func (mr *MockMultiplexerMockRecorder) AddConn(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddConn", reflect.TypeOf((*MockMultiplexer)(nil).AddConn), c, connIDLen, statelessResetKey, tracer) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddConn", reflect.TypeOf((*MockMultiplexer)(nil).AddConn), arg0, arg1, arg2, arg3) } // RemoveConn mocks base method. diff --git a/mock_packer_test.go b/mock_packer_test.go index 985b8821..60d084c1 100644 --- a/mock_packer_test.go +++ b/mock_packer_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: packet_packer.go +// Source: github.com/quic-go/quic-go (interfaces: Packer) // Package quic is a generated GoMock package. package quic @@ -81,18 +81,18 @@ func (mr *MockPackerMockRecorder) PackApplicationClose(arg0, arg1 interface{}) * } // PackCoalescedPacket mocks base method. -func (m *MockPacker) PackCoalescedPacket(onlyAck bool, v protocol.VersionNumber) (*coalescedPacket, error) { +func (m *MockPacker) PackCoalescedPacket(arg0 bool, arg1 protocol.VersionNumber) (*coalescedPacket, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PackCoalescedPacket", onlyAck, v) + ret := m.ctrl.Call(m, "PackCoalescedPacket", arg0, arg1) ret0, _ := ret[0].(*coalescedPacket) ret1, _ := ret[1].(error) return ret0, ret1 } // PackCoalescedPacket indicates an expected call of PackCoalescedPacket. -func (mr *MockPackerMockRecorder) PackCoalescedPacket(onlyAck, v interface{}) *gomock.Call { +func (mr *MockPackerMockRecorder) PackCoalescedPacket(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PackCoalescedPacket", reflect.TypeOf((*MockPacker)(nil).PackCoalescedPacket), onlyAck, v) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PackCoalescedPacket", reflect.TypeOf((*MockPacker)(nil).PackCoalescedPacket), arg0, arg1) } // PackConnectionClose mocks base method. @@ -111,9 +111,9 @@ func (mr *MockPackerMockRecorder) PackConnectionClose(arg0, arg1 interface{}) *g } // PackMTUProbePacket mocks base method. -func (m *MockPacker) PackMTUProbePacket(ping ackhandler.Frame, size protocol.ByteCount, now time.Time, v protocol.VersionNumber) (shortHeaderPacket, *packetBuffer, error) { +func (m *MockPacker) PackMTUProbePacket(arg0 ackhandler.Frame, arg1 protocol.ByteCount, arg2 time.Time, arg3 protocol.VersionNumber) (shortHeaderPacket, *packetBuffer, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PackMTUProbePacket", ping, size, now, v) + ret := m.ctrl.Call(m, "PackMTUProbePacket", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(shortHeaderPacket) ret1, _ := ret[1].(*packetBuffer) ret2, _ := ret[2].(error) @@ -121,15 +121,15 @@ func (m *MockPacker) PackMTUProbePacket(ping ackhandler.Frame, size protocol.Byt } // PackMTUProbePacket indicates an expected call of PackMTUProbePacket. -func (mr *MockPackerMockRecorder) PackMTUProbePacket(ping, size, now, v interface{}) *gomock.Call { +func (mr *MockPackerMockRecorder) PackMTUProbePacket(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PackMTUProbePacket", reflect.TypeOf((*MockPacker)(nil).PackMTUProbePacket), ping, size, now, v) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PackMTUProbePacket", reflect.TypeOf((*MockPacker)(nil).PackMTUProbePacket), arg0, arg1, arg2, arg3) } // PackPacket mocks base method. -func (m *MockPacker) PackPacket(onlyAck bool, now time.Time, v protocol.VersionNumber) (shortHeaderPacket, *packetBuffer, error) { +func (m *MockPacker) PackPacket(arg0 bool, arg1 time.Time, arg2 protocol.VersionNumber) (shortHeaderPacket, *packetBuffer, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "PackPacket", onlyAck, now, v) + ret := m.ctrl.Call(m, "PackPacket", arg0, arg1, arg2) ret0, _ := ret[0].(shortHeaderPacket) ret1, _ := ret[1].(*packetBuffer) ret2, _ := ret[2].(error) @@ -137,9 +137,9 @@ func (m *MockPacker) PackPacket(onlyAck bool, now time.Time, v protocol.VersionN } // PackPacket indicates an expected call of PackPacket. -func (mr *MockPackerMockRecorder) PackPacket(onlyAck, now, v interface{}) *gomock.Call { +func (mr *MockPackerMockRecorder) PackPacket(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PackPacket", reflect.TypeOf((*MockPacker)(nil).PackPacket), onlyAck, now, v) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PackPacket", reflect.TypeOf((*MockPacker)(nil).PackPacket), arg0, arg1, arg2) } // SetMaxPacketSize mocks base method. diff --git a/mock_packet_handler_manager_test.go b/mock_packet_handler_manager_test.go index 4cc8c934..3b71f7f2 100644 --- a/mock_packet_handler_manager_test.go +++ b/mock_packet_handler_manager_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: server.go +// Source: github.com/quic-go/quic-go (interfaces: PacketHandlerManager) // Package quic is a generated GoMock package. package quic diff --git a/mock_packet_handler_test.go b/mock_packet_handler_test.go index 9461ec27..aabc1760 100644 --- a/mock_packet_handler_test.go +++ b/mock_packet_handler_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: server.go +// Source: github.com/quic-go/quic-go (interfaces: PacketHandler) // Package quic is a generated GoMock package. package quic diff --git a/mock_quic_conn_test.go b/mock_quic_conn_test.go index c51ce776..c1d867c3 100644 --- a/mock_quic_conn_test.go +++ b/mock_quic_conn_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: server.go +// Source: github.com/quic-go/quic-go (interfaces: QUICConn) // Package quic is a generated GoMock package. package quic @@ -11,33 +11,34 @@ import ( gomock "github.com/golang/mock/gomock" protocol "github.com/quic-go/quic-go/internal/protocol" + qerr "github.com/quic-go/quic-go/internal/qerr" ) -// MockQuicConn is a mock of QuicConn interface. -type MockQuicConn struct { +// MockQUICConn is a mock of QUICConn interface. +type MockQUICConn struct { ctrl *gomock.Controller - recorder *MockQuicConnMockRecorder + recorder *MockQUICConnMockRecorder } -// MockQuicConnMockRecorder is the mock recorder for MockQuicConn. -type MockQuicConnMockRecorder struct { - mock *MockQuicConn +// MockQUICConnMockRecorder is the mock recorder for MockQUICConn. +type MockQUICConnMockRecorder struct { + mock *MockQUICConn } -// NewMockQuicConn creates a new mock instance. -func NewMockQuicConn(ctrl *gomock.Controller) *MockQuicConn { - mock := &MockQuicConn{ctrl: ctrl} - mock.recorder = &MockQuicConnMockRecorder{mock} +// NewMockQUICConn creates a new mock instance. +func NewMockQUICConn(ctrl *gomock.Controller) *MockQUICConn { + mock := &MockQUICConn{ctrl: ctrl} + mock.recorder = &MockQUICConnMockRecorder{mock} return mock } // EXPECT returns an object that allows the caller to indicate expected use. -func (m *MockQuicConn) EXPECT() *MockQuicConnMockRecorder { +func (m *MockQUICConn) EXPECT() *MockQUICConnMockRecorder { return m.recorder } // AcceptStream mocks base method. -func (m *MockQuicConn) AcceptStream(arg0 context.Context) (Stream, error) { +func (m *MockQUICConn) AcceptStream(arg0 context.Context) (Stream, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "AcceptStream", arg0) ret0, _ := ret[0].(Stream) @@ -46,13 +47,13 @@ func (m *MockQuicConn) AcceptStream(arg0 context.Context) (Stream, error) { } // AcceptStream indicates an expected call of AcceptStream. -func (mr *MockQuicConnMockRecorder) AcceptStream(arg0 interface{}) *gomock.Call { +func (mr *MockQUICConnMockRecorder) AcceptStream(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcceptStream", reflect.TypeOf((*MockQuicConn)(nil).AcceptStream), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcceptStream", reflect.TypeOf((*MockQUICConn)(nil).AcceptStream), arg0) } // AcceptUniStream mocks base method. -func (m *MockQuicConn) AcceptUniStream(arg0 context.Context) (ReceiveStream, error) { +func (m *MockQUICConn) AcceptUniStream(arg0 context.Context) (ReceiveStream, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "AcceptUniStream", arg0) ret0, _ := ret[0].(ReceiveStream) @@ -61,13 +62,13 @@ func (m *MockQuicConn) AcceptUniStream(arg0 context.Context) (ReceiveStream, err } // AcceptUniStream indicates an expected call of AcceptUniStream. -func (mr *MockQuicConnMockRecorder) AcceptUniStream(arg0 interface{}) *gomock.Call { +func (mr *MockQUICConnMockRecorder) AcceptUniStream(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcceptUniStream", reflect.TypeOf((*MockQuicConn)(nil).AcceptUniStream), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AcceptUniStream", reflect.TypeOf((*MockQUICConn)(nil).AcceptUniStream), arg0) } // CloseWithError mocks base method. -func (m *MockQuicConn) CloseWithError(arg0 ApplicationErrorCode, arg1 string) error { +func (m *MockQUICConn) CloseWithError(arg0 qerr.ApplicationErrorCode, arg1 string) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "CloseWithError", arg0, arg1) ret0, _ := ret[0].(error) @@ -75,13 +76,13 @@ func (m *MockQuicConn) CloseWithError(arg0 ApplicationErrorCode, arg1 string) er } // CloseWithError indicates an expected call of CloseWithError. -func (mr *MockQuicConnMockRecorder) CloseWithError(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockQUICConnMockRecorder) CloseWithError(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseWithError", reflect.TypeOf((*MockQuicConn)(nil).CloseWithError), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseWithError", reflect.TypeOf((*MockQUICConn)(nil).CloseWithError), arg0, arg1) } // ConnectionState mocks base method. -func (m *MockQuicConn) ConnectionState() ConnectionState { +func (m *MockQUICConn) ConnectionState() ConnectionState { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ConnectionState") ret0, _ := ret[0].(ConnectionState) @@ -89,13 +90,13 @@ func (m *MockQuicConn) ConnectionState() ConnectionState { } // ConnectionState indicates an expected call of ConnectionState. -func (mr *MockQuicConnMockRecorder) ConnectionState() *gomock.Call { +func (mr *MockQUICConnMockRecorder) ConnectionState() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConnectionState", reflect.TypeOf((*MockQuicConn)(nil).ConnectionState)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConnectionState", reflect.TypeOf((*MockQUICConn)(nil).ConnectionState)) } // Context mocks base method. -func (m *MockQuicConn) Context() context.Context { +func (m *MockQUICConn) Context() context.Context { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Context") ret0, _ := ret[0].(context.Context) @@ -103,13 +104,13 @@ func (m *MockQuicConn) Context() context.Context { } // Context indicates an expected call of Context. -func (mr *MockQuicConnMockRecorder) Context() *gomock.Call { +func (mr *MockQUICConnMockRecorder) Context() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockQuicConn)(nil).Context)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockQUICConn)(nil).Context)) } // GetVersion mocks base method. -func (m *MockQuicConn) GetVersion() protocol.VersionNumber { +func (m *MockQUICConn) GetVersion() protocol.VersionNumber { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetVersion") ret0, _ := ret[0].(protocol.VersionNumber) @@ -117,13 +118,13 @@ func (m *MockQuicConn) GetVersion() protocol.VersionNumber { } // GetVersion indicates an expected call of GetVersion. -func (mr *MockQuicConnMockRecorder) GetVersion() *gomock.Call { +func (mr *MockQUICConnMockRecorder) GetVersion() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetVersion", reflect.TypeOf((*MockQuicConn)(nil).GetVersion)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetVersion", reflect.TypeOf((*MockQUICConn)(nil).GetVersion)) } // HandshakeComplete mocks base method. -func (m *MockQuicConn) HandshakeComplete() <-chan struct{} { +func (m *MockQUICConn) HandshakeComplete() <-chan struct{} { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "HandshakeComplete") ret0, _ := ret[0].(<-chan struct{}) @@ -131,13 +132,13 @@ func (m *MockQuicConn) HandshakeComplete() <-chan struct{} { } // HandshakeComplete indicates an expected call of HandshakeComplete. -func (mr *MockQuicConnMockRecorder) HandshakeComplete() *gomock.Call { +func (mr *MockQUICConnMockRecorder) HandshakeComplete() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandshakeComplete", reflect.TypeOf((*MockQuicConn)(nil).HandshakeComplete)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HandshakeComplete", reflect.TypeOf((*MockQUICConn)(nil).HandshakeComplete)) } // LocalAddr mocks base method. -func (m *MockQuicConn) LocalAddr() net.Addr { +func (m *MockQUICConn) LocalAddr() net.Addr { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "LocalAddr") ret0, _ := ret[0].(net.Addr) @@ -145,13 +146,13 @@ func (m *MockQuicConn) LocalAddr() net.Addr { } // LocalAddr indicates an expected call of LocalAddr. -func (mr *MockQuicConnMockRecorder) LocalAddr() *gomock.Call { +func (mr *MockQUICConnMockRecorder) LocalAddr() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LocalAddr", reflect.TypeOf((*MockQuicConn)(nil).LocalAddr)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LocalAddr", reflect.TypeOf((*MockQUICConn)(nil).LocalAddr)) } // NextConnection mocks base method. -func (m *MockQuicConn) NextConnection() Connection { +func (m *MockQUICConn) NextConnection() Connection { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "NextConnection") ret0, _ := ret[0].(Connection) @@ -159,13 +160,13 @@ func (m *MockQuicConn) NextConnection() Connection { } // NextConnection indicates an expected call of NextConnection. -func (mr *MockQuicConnMockRecorder) NextConnection() *gomock.Call { +func (mr *MockQUICConnMockRecorder) NextConnection() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NextConnection", reflect.TypeOf((*MockQuicConn)(nil).NextConnection)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NextConnection", reflect.TypeOf((*MockQUICConn)(nil).NextConnection)) } // OpenStream mocks base method. -func (m *MockQuicConn) OpenStream() (Stream, error) { +func (m *MockQUICConn) OpenStream() (Stream, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "OpenStream") ret0, _ := ret[0].(Stream) @@ -174,13 +175,13 @@ func (m *MockQuicConn) OpenStream() (Stream, error) { } // OpenStream indicates an expected call of OpenStream. -func (mr *MockQuicConnMockRecorder) OpenStream() *gomock.Call { +func (mr *MockQUICConnMockRecorder) OpenStream() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OpenStream", reflect.TypeOf((*MockQuicConn)(nil).OpenStream)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OpenStream", reflect.TypeOf((*MockQUICConn)(nil).OpenStream)) } // OpenStreamSync mocks base method. -func (m *MockQuicConn) OpenStreamSync(arg0 context.Context) (Stream, error) { +func (m *MockQUICConn) OpenStreamSync(arg0 context.Context) (Stream, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "OpenStreamSync", arg0) ret0, _ := ret[0].(Stream) @@ -189,13 +190,13 @@ func (m *MockQuicConn) OpenStreamSync(arg0 context.Context) (Stream, error) { } // OpenStreamSync indicates an expected call of OpenStreamSync. -func (mr *MockQuicConnMockRecorder) OpenStreamSync(arg0 interface{}) *gomock.Call { +func (mr *MockQUICConnMockRecorder) OpenStreamSync(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OpenStreamSync", reflect.TypeOf((*MockQuicConn)(nil).OpenStreamSync), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OpenStreamSync", reflect.TypeOf((*MockQUICConn)(nil).OpenStreamSync), arg0) } // OpenUniStream mocks base method. -func (m *MockQuicConn) OpenUniStream() (SendStream, error) { +func (m *MockQUICConn) OpenUniStream() (SendStream, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "OpenUniStream") ret0, _ := ret[0].(SendStream) @@ -204,13 +205,13 @@ func (m *MockQuicConn) OpenUniStream() (SendStream, error) { } // OpenUniStream indicates an expected call of OpenUniStream. -func (mr *MockQuicConnMockRecorder) OpenUniStream() *gomock.Call { +func (mr *MockQUICConnMockRecorder) OpenUniStream() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OpenUniStream", reflect.TypeOf((*MockQuicConn)(nil).OpenUniStream)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OpenUniStream", reflect.TypeOf((*MockQUICConn)(nil).OpenUniStream)) } // OpenUniStreamSync mocks base method. -func (m *MockQuicConn) OpenUniStreamSync(arg0 context.Context) (SendStream, error) { +func (m *MockQUICConn) OpenUniStreamSync(arg0 context.Context) (SendStream, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "OpenUniStreamSync", arg0) ret0, _ := ret[0].(SendStream) @@ -219,13 +220,13 @@ func (m *MockQuicConn) OpenUniStreamSync(arg0 context.Context) (SendStream, erro } // OpenUniStreamSync indicates an expected call of OpenUniStreamSync. -func (mr *MockQuicConnMockRecorder) OpenUniStreamSync(arg0 interface{}) *gomock.Call { +func (mr *MockQUICConnMockRecorder) OpenUniStreamSync(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OpenUniStreamSync", reflect.TypeOf((*MockQuicConn)(nil).OpenUniStreamSync), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "OpenUniStreamSync", reflect.TypeOf((*MockQUICConn)(nil).OpenUniStreamSync), arg0) } // ReceiveMessage mocks base method. -func (m *MockQuicConn) ReceiveMessage() ([]byte, error) { +func (m *MockQUICConn) ReceiveMessage() ([]byte, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "ReceiveMessage") ret0, _ := ret[0].([]byte) @@ -234,13 +235,13 @@ func (m *MockQuicConn) ReceiveMessage() ([]byte, error) { } // ReceiveMessage indicates an expected call of ReceiveMessage. -func (mr *MockQuicConnMockRecorder) ReceiveMessage() *gomock.Call { +func (mr *MockQUICConnMockRecorder) ReceiveMessage() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReceiveMessage", reflect.TypeOf((*MockQuicConn)(nil).ReceiveMessage)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReceiveMessage", reflect.TypeOf((*MockQUICConn)(nil).ReceiveMessage)) } // RemoteAddr mocks base method. -func (m *MockQuicConn) RemoteAddr() net.Addr { +func (m *MockQUICConn) RemoteAddr() net.Addr { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "RemoteAddr") ret0, _ := ret[0].(net.Addr) @@ -248,13 +249,13 @@ func (m *MockQuicConn) RemoteAddr() net.Addr { } // RemoteAddr indicates an expected call of RemoteAddr. -func (mr *MockQuicConnMockRecorder) RemoteAddr() *gomock.Call { +func (mr *MockQUICConnMockRecorder) RemoteAddr() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoteAddr", reflect.TypeOf((*MockQuicConn)(nil).RemoteAddr)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoteAddr", reflect.TypeOf((*MockQUICConn)(nil).RemoteAddr)) } // SendMessage mocks base method. -func (m *MockQuicConn) SendMessage(arg0 []byte) error { +func (m *MockQUICConn) SendMessage(arg0 []byte) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SendMessage", arg0) ret0, _ := ret[0].(error) @@ -262,25 +263,25 @@ func (m *MockQuicConn) SendMessage(arg0 []byte) error { } // SendMessage indicates an expected call of SendMessage. -func (mr *MockQuicConnMockRecorder) SendMessage(arg0 interface{}) *gomock.Call { +func (mr *MockQUICConnMockRecorder) SendMessage(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMessage", reflect.TypeOf((*MockQuicConn)(nil).SendMessage), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMessage", reflect.TypeOf((*MockQUICConn)(nil).SendMessage), arg0) } // destroy mocks base method. -func (m *MockQuicConn) destroy(arg0 error) { +func (m *MockQUICConn) destroy(arg0 error) { m.ctrl.T.Helper() m.ctrl.Call(m, "destroy", arg0) } // destroy indicates an expected call of destroy. -func (mr *MockQuicConnMockRecorder) destroy(arg0 interface{}) *gomock.Call { +func (mr *MockQUICConnMockRecorder) destroy(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "destroy", reflect.TypeOf((*MockQuicConn)(nil).destroy), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "destroy", reflect.TypeOf((*MockQUICConn)(nil).destroy), arg0) } // earlyConnReady mocks base method. -func (m *MockQuicConn) earlyConnReady() <-chan struct{} { +func (m *MockQUICConn) earlyConnReady() <-chan struct{} { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "earlyConnReady") ret0, _ := ret[0].(<-chan struct{}) @@ -288,13 +289,13 @@ func (m *MockQuicConn) earlyConnReady() <-chan struct{} { } // earlyConnReady indicates an expected call of earlyConnReady. -func (mr *MockQuicConnMockRecorder) earlyConnReady() *gomock.Call { +func (mr *MockQUICConnMockRecorder) earlyConnReady() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "earlyConnReady", reflect.TypeOf((*MockQuicConn)(nil).earlyConnReady)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "earlyConnReady", reflect.TypeOf((*MockQUICConn)(nil).earlyConnReady)) } // getPerspective mocks base method. -func (m *MockQuicConn) getPerspective() protocol.Perspective { +func (m *MockQUICConn) getPerspective() protocol.Perspective { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "getPerspective") ret0, _ := ret[0].(protocol.Perspective) @@ -302,25 +303,25 @@ func (m *MockQuicConn) getPerspective() protocol.Perspective { } // getPerspective indicates an expected call of getPerspective. -func (mr *MockQuicConnMockRecorder) getPerspective() *gomock.Call { +func (mr *MockQUICConnMockRecorder) getPerspective() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "getPerspective", reflect.TypeOf((*MockQuicConn)(nil).getPerspective)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "getPerspective", reflect.TypeOf((*MockQUICConn)(nil).getPerspective)) } // handlePacket mocks base method. -func (m *MockQuicConn) handlePacket(arg0 *receivedPacket) { +func (m *MockQUICConn) handlePacket(arg0 *receivedPacket) { m.ctrl.T.Helper() m.ctrl.Call(m, "handlePacket", arg0) } // handlePacket indicates an expected call of handlePacket. -func (mr *MockQuicConnMockRecorder) handlePacket(arg0 interface{}) *gomock.Call { +func (mr *MockQUICConnMockRecorder) handlePacket(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "handlePacket", reflect.TypeOf((*MockQuicConn)(nil).handlePacket), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "handlePacket", reflect.TypeOf((*MockQUICConn)(nil).handlePacket), arg0) } // run mocks base method. -func (m *MockQuicConn) run() error { +func (m *MockQUICConn) run() error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "run") ret0, _ := ret[0].(error) @@ -328,19 +329,19 @@ func (m *MockQuicConn) run() error { } // run indicates an expected call of run. -func (mr *MockQuicConnMockRecorder) run() *gomock.Call { +func (mr *MockQUICConnMockRecorder) run() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "run", reflect.TypeOf((*MockQuicConn)(nil).run)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "run", reflect.TypeOf((*MockQUICConn)(nil).run)) } // shutdown mocks base method. -func (m *MockQuicConn) shutdown() { +func (m *MockQUICConn) shutdown() { m.ctrl.T.Helper() m.ctrl.Call(m, "shutdown") } // shutdown indicates an expected call of shutdown. -func (mr *MockQuicConnMockRecorder) shutdown() *gomock.Call { +func (mr *MockQUICConnMockRecorder) shutdown() *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "shutdown", reflect.TypeOf((*MockQuicConn)(nil).shutdown)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "shutdown", reflect.TypeOf((*MockQUICConn)(nil).shutdown)) } diff --git a/mock_receive_stream_internal_test.go b/mock_receive_stream_internal_test.go index 1f0d19f6..a4cbb276 100644 --- a/mock_receive_stream_internal_test.go +++ b/mock_receive_stream_internal_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: receive_stream.go +// Source: github.com/quic-go/quic-go (interfaces: ReceiveStreamI) // Package quic is a generated GoMock package. package quic @@ -10,6 +10,7 @@ import ( gomock "github.com/golang/mock/gomock" protocol "github.com/quic-go/quic-go/internal/protocol" + qerr "github.com/quic-go/quic-go/internal/qerr" wire "github.com/quic-go/quic-go/internal/wire" ) @@ -37,7 +38,7 @@ func (m *MockReceiveStreamI) EXPECT() *MockReceiveStreamIMockRecorder { } // CancelRead mocks base method. -func (m *MockReceiveStreamI) CancelRead(arg0 StreamErrorCode) { +func (m *MockReceiveStreamI) CancelRead(arg0 qerr.StreamErrorCode) { m.ctrl.T.Helper() m.ctrl.Call(m, "CancelRead", arg0) } @@ -49,39 +50,39 @@ func (mr *MockReceiveStreamIMockRecorder) CancelRead(arg0 interface{}) *gomock.C } // Read mocks base method. -func (m *MockReceiveStreamI) Read(p []byte) (int, error) { +func (m *MockReceiveStreamI) Read(arg0 []byte) (int, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Read", p) + ret := m.ctrl.Call(m, "Read", arg0) ret0, _ := ret[0].(int) ret1, _ := ret[1].(error) return ret0, ret1 } // Read indicates an expected call of Read. -func (mr *MockReceiveStreamIMockRecorder) Read(p interface{}) *gomock.Call { +func (mr *MockReceiveStreamIMockRecorder) Read(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockReceiveStreamI)(nil).Read), p) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockReceiveStreamI)(nil).Read), arg0) } // SetReadDeadline mocks base method. -func (m *MockReceiveStreamI) SetReadDeadline(t time.Time) error { +func (m *MockReceiveStreamI) SetReadDeadline(arg0 time.Time) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetReadDeadline", t) + ret := m.ctrl.Call(m, "SetReadDeadline", arg0) ret0, _ := ret[0].(error) return ret0 } // SetReadDeadline indicates an expected call of SetReadDeadline. -func (mr *MockReceiveStreamIMockRecorder) SetReadDeadline(t interface{}) *gomock.Call { +func (mr *MockReceiveStreamIMockRecorder) SetReadDeadline(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetReadDeadline", reflect.TypeOf((*MockReceiveStreamI)(nil).SetReadDeadline), t) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetReadDeadline", reflect.TypeOf((*MockReceiveStreamI)(nil).SetReadDeadline), arg0) } // StreamID mocks base method. -func (m *MockReceiveStreamI) StreamID() StreamID { +func (m *MockReceiveStreamI) StreamID() protocol.StreamID { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StreamID") - ret0, _ := ret[0].(StreamID) + ret0, _ := ret[0].(protocol.StreamID) return ret0 } diff --git a/mock_sealing_manager_test.go b/mock_sealing_manager_test.go index 5dc82eb9..26e442e5 100644 --- a/mock_sealing_manager_test.go +++ b/mock_sealing_manager_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: packet_packer.go +// Source: github.com/quic-go/quic-go (interfaces: SealingManager) // Package quic is a generated GoMock package. package quic diff --git a/mock_send_conn_test.go b/mock_send_conn_test.go index d66fec5f..a0fb66f0 100644 --- a/mock_send_conn_test.go +++ b/mock_send_conn_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: send_conn.go +// Source: github.com/quic-go/quic-go (interfaces: SendConn) // Package quic is a generated GoMock package. package quic diff --git a/mock_send_stream_internal_test.go b/mock_send_stream_internal_test.go index 312bd7ec..df9e4fbb 100644 --- a/mock_send_stream_internal_test.go +++ b/mock_send_stream_internal_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: send_stream.go +// Source: github.com/quic-go/quic-go (interfaces: SendStreamI) // Package quic is a generated GoMock package. package quic @@ -12,6 +12,7 @@ import ( gomock "github.com/golang/mock/gomock" ackhandler "github.com/quic-go/quic-go/internal/ackhandler" protocol "github.com/quic-go/quic-go/internal/protocol" + qerr "github.com/quic-go/quic-go/internal/qerr" wire "github.com/quic-go/quic-go/internal/wire" ) @@ -39,7 +40,7 @@ func (m *MockSendStreamI) EXPECT() *MockSendStreamIMockRecorder { } // CancelWrite mocks base method. -func (m *MockSendStreamI) CancelWrite(arg0 StreamErrorCode) { +func (m *MockSendStreamI) CancelWrite(arg0 qerr.StreamErrorCode) { m.ctrl.T.Helper() m.ctrl.Call(m, "CancelWrite", arg0) } @@ -79,24 +80,24 @@ func (mr *MockSendStreamIMockRecorder) Context() *gomock.Call { } // SetWriteDeadline mocks base method. -func (m *MockSendStreamI) SetWriteDeadline(t time.Time) error { +func (m *MockSendStreamI) SetWriteDeadline(arg0 time.Time) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetWriteDeadline", t) + ret := m.ctrl.Call(m, "SetWriteDeadline", arg0) ret0, _ := ret[0].(error) return ret0 } // SetWriteDeadline indicates an expected call of SetWriteDeadline. -func (mr *MockSendStreamIMockRecorder) SetWriteDeadline(t interface{}) *gomock.Call { +func (mr *MockSendStreamIMockRecorder) SetWriteDeadline(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetWriteDeadline", reflect.TypeOf((*MockSendStreamI)(nil).SetWriteDeadline), t) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetWriteDeadline", reflect.TypeOf((*MockSendStreamI)(nil).SetWriteDeadline), arg0) } // StreamID mocks base method. -func (m *MockSendStreamI) StreamID() StreamID { +func (m *MockSendStreamI) StreamID() protocol.StreamID { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StreamID") - ret0, _ := ret[0].(StreamID) + ret0, _ := ret[0].(protocol.StreamID) return ret0 } @@ -107,18 +108,18 @@ func (mr *MockSendStreamIMockRecorder) StreamID() *gomock.Call { } // Write mocks base method. -func (m *MockSendStreamI) Write(p []byte) (int, error) { +func (m *MockSendStreamI) Write(arg0 []byte) (int, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Write", p) + ret := m.ctrl.Call(m, "Write", arg0) ret0, _ := ret[0].(int) ret1, _ := ret[1].(error) return ret0, ret1 } // Write indicates an expected call of Write. -func (mr *MockSendStreamIMockRecorder) Write(p interface{}) *gomock.Call { +func (mr *MockSendStreamIMockRecorder) Write(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockSendStreamI)(nil).Write), p) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockSendStreamI)(nil).Write), arg0) } // closeForShutdown mocks base method. @@ -160,18 +161,18 @@ func (mr *MockSendStreamIMockRecorder) hasData() *gomock.Call { } // popStreamFrame mocks base method. -func (m *MockSendStreamI) popStreamFrame(maxBytes protocol.ByteCount, v protocol.VersionNumber) (*ackhandler.Frame, bool) { +func (m *MockSendStreamI) popStreamFrame(arg0 protocol.ByteCount, arg1 protocol.VersionNumber) (*ackhandler.Frame, bool) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "popStreamFrame", maxBytes, v) + ret := m.ctrl.Call(m, "popStreamFrame", arg0, arg1) ret0, _ := ret[0].(*ackhandler.Frame) ret1, _ := ret[1].(bool) return ret0, ret1 } // popStreamFrame indicates an expected call of popStreamFrame. -func (mr *MockSendStreamIMockRecorder) popStreamFrame(maxBytes, v interface{}) *gomock.Call { +func (mr *MockSendStreamIMockRecorder) popStreamFrame(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "popStreamFrame", reflect.TypeOf((*MockSendStreamI)(nil).popStreamFrame), maxBytes, v) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "popStreamFrame", reflect.TypeOf((*MockSendStreamI)(nil).popStreamFrame), arg0, arg1) } // updateSendWindow mocks base method. diff --git a/mock_sender_test.go b/mock_sender_test.go index bad5f149..3ec60235 100644 --- a/mock_sender_test.go +++ b/mock_sender_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: send_queue.go +// Source: github.com/quic-go/quic-go (interfaces: Sender) // Package quic is a generated GoMock package. package quic @@ -74,15 +74,15 @@ func (mr *MockSenderMockRecorder) Run() *gomock.Call { } // Send mocks base method. -func (m *MockSender) Send(p *packetBuffer) { +func (m *MockSender) Send(arg0 *packetBuffer) { m.ctrl.T.Helper() - m.ctrl.Call(m, "Send", p) + m.ctrl.Call(m, "Send", arg0) } // Send indicates an expected call of Send. -func (mr *MockSenderMockRecorder) Send(p interface{}) *gomock.Call { +func (mr *MockSenderMockRecorder) Send(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockSender)(nil).Send), p) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockSender)(nil).Send), arg0) } // WouldBlock mocks base method. diff --git a/mock_stream_getter_test.go b/mock_stream_getter_test.go index 57883f8f..d0238750 100644 --- a/mock_stream_getter_test.go +++ b/mock_stream_getter_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: connection.go +// Source: github.com/quic-go/quic-go (interfaces: StreamGetter) // Package quic is a generated GoMock package. package quic diff --git a/mock_stream_internal_test.go b/mock_stream_internal_test.go index 3e2f8833..f617c6e3 100644 --- a/mock_stream_internal_test.go +++ b/mock_stream_internal_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: stream.go +// Source: github.com/quic-go/quic-go (interfaces: StreamI) // Package quic is a generated GoMock package. package quic @@ -12,6 +12,7 @@ import ( gomock "github.com/golang/mock/gomock" ackhandler "github.com/quic-go/quic-go/internal/ackhandler" protocol "github.com/quic-go/quic-go/internal/protocol" + qerr "github.com/quic-go/quic-go/internal/qerr" wire "github.com/quic-go/quic-go/internal/wire" ) @@ -39,7 +40,7 @@ func (m *MockStreamI) EXPECT() *MockStreamIMockRecorder { } // CancelRead mocks base method. -func (m *MockStreamI) CancelRead(arg0 StreamErrorCode) { +func (m *MockStreamI) CancelRead(arg0 qerr.StreamErrorCode) { m.ctrl.T.Helper() m.ctrl.Call(m, "CancelRead", arg0) } @@ -51,7 +52,7 @@ func (mr *MockStreamIMockRecorder) CancelRead(arg0 interface{}) *gomock.Call { } // CancelWrite mocks base method. -func (m *MockStreamI) CancelWrite(arg0 StreamErrorCode) { +func (m *MockStreamI) CancelWrite(arg0 qerr.StreamErrorCode) { m.ctrl.T.Helper() m.ctrl.Call(m, "CancelWrite", arg0) } @@ -91,67 +92,67 @@ func (mr *MockStreamIMockRecorder) Context() *gomock.Call { } // Read mocks base method. -func (m *MockStreamI) Read(p []byte) (int, error) { +func (m *MockStreamI) Read(arg0 []byte) (int, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Read", p) + ret := m.ctrl.Call(m, "Read", arg0) ret0, _ := ret[0].(int) ret1, _ := ret[1].(error) return ret0, ret1 } // Read indicates an expected call of Read. -func (mr *MockStreamIMockRecorder) Read(p interface{}) *gomock.Call { +func (mr *MockStreamIMockRecorder) Read(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockStreamI)(nil).Read), p) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockStreamI)(nil).Read), arg0) } // SetDeadline mocks base method. -func (m *MockStreamI) SetDeadline(t time.Time) error { +func (m *MockStreamI) SetDeadline(arg0 time.Time) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetDeadline", t) + ret := m.ctrl.Call(m, "SetDeadline", arg0) ret0, _ := ret[0].(error) return ret0 } // SetDeadline indicates an expected call of SetDeadline. -func (mr *MockStreamIMockRecorder) SetDeadline(t interface{}) *gomock.Call { +func (mr *MockStreamIMockRecorder) SetDeadline(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDeadline", reflect.TypeOf((*MockStreamI)(nil).SetDeadline), t) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDeadline", reflect.TypeOf((*MockStreamI)(nil).SetDeadline), arg0) } // SetReadDeadline mocks base method. -func (m *MockStreamI) SetReadDeadline(t time.Time) error { +func (m *MockStreamI) SetReadDeadline(arg0 time.Time) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetReadDeadline", t) + ret := m.ctrl.Call(m, "SetReadDeadline", arg0) ret0, _ := ret[0].(error) return ret0 } // SetReadDeadline indicates an expected call of SetReadDeadline. -func (mr *MockStreamIMockRecorder) SetReadDeadline(t interface{}) *gomock.Call { +func (mr *MockStreamIMockRecorder) SetReadDeadline(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetReadDeadline", reflect.TypeOf((*MockStreamI)(nil).SetReadDeadline), t) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetReadDeadline", reflect.TypeOf((*MockStreamI)(nil).SetReadDeadline), arg0) } // SetWriteDeadline mocks base method. -func (m *MockStreamI) SetWriteDeadline(t time.Time) error { +func (m *MockStreamI) SetWriteDeadline(arg0 time.Time) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetWriteDeadline", t) + ret := m.ctrl.Call(m, "SetWriteDeadline", arg0) ret0, _ := ret[0].(error) return ret0 } // SetWriteDeadline indicates an expected call of SetWriteDeadline. -func (mr *MockStreamIMockRecorder) SetWriteDeadline(t interface{}) *gomock.Call { +func (mr *MockStreamIMockRecorder) SetWriteDeadline(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetWriteDeadline", reflect.TypeOf((*MockStreamI)(nil).SetWriteDeadline), t) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetWriteDeadline", reflect.TypeOf((*MockStreamI)(nil).SetWriteDeadline), arg0) } // StreamID mocks base method. -func (m *MockStreamI) StreamID() StreamID { +func (m *MockStreamI) StreamID() protocol.StreamID { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "StreamID") - ret0, _ := ret[0].(StreamID) + ret0, _ := ret[0].(protocol.StreamID) return ret0 } @@ -162,18 +163,18 @@ func (mr *MockStreamIMockRecorder) StreamID() *gomock.Call { } // Write mocks base method. -func (m *MockStreamI) Write(p []byte) (int, error) { +func (m *MockStreamI) Write(arg0 []byte) (int, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Write", p) + ret := m.ctrl.Call(m, "Write", arg0) ret0, _ := ret[0].(int) ret1, _ := ret[1].(error) return ret0, ret1 } // Write indicates an expected call of Write. -func (mr *MockStreamIMockRecorder) Write(p interface{}) *gomock.Call { +func (mr *MockStreamIMockRecorder) Write(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockStreamI)(nil).Write), p) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockStreamI)(nil).Write), arg0) } // closeForShutdown mocks base method. @@ -257,18 +258,18 @@ func (mr *MockStreamIMockRecorder) hasData() *gomock.Call { } // popStreamFrame mocks base method. -func (m *MockStreamI) popStreamFrame(maxBytes protocol.ByteCount, v protocol.VersionNumber) (*ackhandler.Frame, bool) { +func (m *MockStreamI) popStreamFrame(arg0 protocol.ByteCount, arg1 protocol.VersionNumber) (*ackhandler.Frame, bool) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "popStreamFrame", maxBytes, v) + ret := m.ctrl.Call(m, "popStreamFrame", arg0, arg1) ret0, _ := ret[0].(*ackhandler.Frame) ret1, _ := ret[1].(bool) return ret0, ret1 } // popStreamFrame indicates an expected call of popStreamFrame. -func (mr *MockStreamIMockRecorder) popStreamFrame(maxBytes, v interface{}) *gomock.Call { +func (mr *MockStreamIMockRecorder) popStreamFrame(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "popStreamFrame", reflect.TypeOf((*MockStreamI)(nil).popStreamFrame), maxBytes, v) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "popStreamFrame", reflect.TypeOf((*MockStreamI)(nil).popStreamFrame), arg0, arg1) } // updateSendWindow mocks base method. diff --git a/mock_stream_manager_test.go b/mock_stream_manager_test.go index c13366e9..2159372d 100644 --- a/mock_stream_manager_test.go +++ b/mock_stream_manager_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: connection.go +// Source: github.com/quic-go/quic-go (interfaces: StreamManager) // Package quic is a generated GoMock package. package quic diff --git a/mock_stream_sender_test.go b/mock_stream_sender_test.go index e825c6d3..b4898c67 100644 --- a/mock_stream_sender_test.go +++ b/mock_stream_sender_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: stream.go +// Source: github.com/quic-go/quic-go (interfaces: StreamSender) // Package quic is a generated GoMock package. package quic diff --git a/mock_unknown_packet_handler_test.go b/mock_unknown_packet_handler_test.go index d82acf1a..f8d63ef0 100644 --- a/mock_unknown_packet_handler_test.go +++ b/mock_unknown_packet_handler_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: server.go +// Source: github.com/quic-go/quic-go (interfaces: UnknownPacketHandler) // Package quic is a generated GoMock package. package quic diff --git a/mock_unpacker_test.go b/mock_unpacker_test.go index 715f84d9..a144fb4c 100644 --- a/mock_unpacker_test.go +++ b/mock_unpacker_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: connection.go +// Source: github.com/quic-go/quic-go (interfaces: Unpacker) // Package quic is a generated GoMock package. package quic @@ -37,24 +37,24 @@ func (m *MockUnpacker) EXPECT() *MockUnpackerMockRecorder { } // UnpackLongHeader mocks base method. -func (m *MockUnpacker) UnpackLongHeader(hdr *wire.Header, rcvTime time.Time, data []byte, v protocol.VersionNumber) (*unpackedPacket, error) { +func (m *MockUnpacker) UnpackLongHeader(arg0 *wire.Header, arg1 time.Time, arg2 []byte, arg3 protocol.VersionNumber) (*unpackedPacket, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UnpackLongHeader", hdr, rcvTime, data, v) + ret := m.ctrl.Call(m, "UnpackLongHeader", arg0, arg1, arg2, arg3) ret0, _ := ret[0].(*unpackedPacket) ret1, _ := ret[1].(error) return ret0, ret1 } // UnpackLongHeader indicates an expected call of UnpackLongHeader. -func (mr *MockUnpackerMockRecorder) UnpackLongHeader(hdr, rcvTime, data, v interface{}) *gomock.Call { +func (mr *MockUnpackerMockRecorder) UnpackLongHeader(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnpackLongHeader", reflect.TypeOf((*MockUnpacker)(nil).UnpackLongHeader), hdr, rcvTime, data, v) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnpackLongHeader", reflect.TypeOf((*MockUnpacker)(nil).UnpackLongHeader), arg0, arg1, arg2, arg3) } // UnpackShortHeader mocks base method. -func (m *MockUnpacker) UnpackShortHeader(rcvTime time.Time, data []byte) (protocol.PacketNumber, protocol.PacketNumberLen, protocol.KeyPhaseBit, []byte, error) { +func (m *MockUnpacker) UnpackShortHeader(arg0 time.Time, arg1 []byte) (protocol.PacketNumber, protocol.PacketNumberLen, protocol.KeyPhaseBit, []byte, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "UnpackShortHeader", rcvTime, data) + ret := m.ctrl.Call(m, "UnpackShortHeader", arg0, arg1) ret0, _ := ret[0].(protocol.PacketNumber) ret1, _ := ret[1].(protocol.PacketNumberLen) ret2, _ := ret[2].(protocol.KeyPhaseBit) @@ -64,7 +64,7 @@ func (m *MockUnpacker) UnpackShortHeader(rcvTime time.Time, data []byte) (protoc } // UnpackShortHeader indicates an expected call of UnpackShortHeader. -func (mr *MockUnpackerMockRecorder) UnpackShortHeader(rcvTime, data interface{}) *gomock.Call { +func (mr *MockUnpackerMockRecorder) UnpackShortHeader(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnpackShortHeader", reflect.TypeOf((*MockUnpacker)(nil).UnpackShortHeader), rcvTime, data) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnpackShortHeader", reflect.TypeOf((*MockUnpacker)(nil).UnpackShortHeader), arg0, arg1) } diff --git a/mockgen.go b/mockgen.go index abe1faab..443e9c10 100644 --- a/mockgen.go +++ b/mockgen.go @@ -1,27 +1,77 @@ +//go:build gomock || generate + package quic -//go:generate sh -c "./mockgen_private.sh quic mock_send_conn_test.go github.com/quic-go/quic-go sendConn" -//go:generate sh -c "./mockgen_private.sh quic mock_sender_test.go github.com/quic-go/quic-go sender" -//go:generate sh -c "./mockgen_private.sh quic mock_stream_internal_test.go github.com/quic-go/quic-go streamI" -//go:generate sh -c "./mockgen_private.sh quic mock_crypto_stream_test.go github.com/quic-go/quic-go cryptoStream" -//go:generate sh -c "./mockgen_private.sh quic mock_receive_stream_internal_test.go github.com/quic-go/quic-go receiveStreamI" -//go:generate sh -c "./mockgen_private.sh quic mock_send_stream_internal_test.go github.com/quic-go/quic-go sendStreamI" -//go:generate sh -c "./mockgen_private.sh quic mock_stream_sender_test.go github.com/quic-go/quic-go streamSender" -//go:generate sh -c "./mockgen_private.sh quic mock_stream_getter_test.go github.com/quic-go/quic-go streamGetter" -//go:generate sh -c "./mockgen_private.sh quic mock_crypto_data_handler_test.go github.com/quic-go/quic-go cryptoDataHandler" -//go:generate sh -c "./mockgen_private.sh quic mock_frame_source_test.go github.com/quic-go/quic-go frameSource" -//go:generate sh -c "./mockgen_private.sh quic mock_ack_frame_source_test.go github.com/quic-go/quic-go ackFrameSource" -//go:generate sh -c "./mockgen_private.sh quic mock_stream_manager_test.go github.com/quic-go/quic-go streamManager" -//go:generate sh -c "./mockgen_private.sh quic mock_sealing_manager_test.go github.com/quic-go/quic-go sealingManager" -//go:generate sh -c "./mockgen_private.sh quic mock_unpacker_test.go github.com/quic-go/quic-go unpacker" -//go:generate sh -c "./mockgen_private.sh quic mock_packer_test.go github.com/quic-go/quic-go packer" -//go:generate sh -c "./mockgen_private.sh quic mock_mtu_discoverer_test.go github.com/quic-go/quic-go mtuDiscoverer" -//go:generate sh -c "./mockgen_private.sh quic mock_conn_runner_test.go github.com/quic-go/quic-go connRunner" -//go:generate sh -c "./mockgen_private.sh quic mock_quic_conn_test.go github.com/quic-go/quic-go quicConn" -//go:generate sh -c "./mockgen_private.sh quic mock_packet_handler_test.go github.com/quic-go/quic-go packetHandler" -//go:generate sh -c "./mockgen_private.sh quic mock_unknown_packet_handler_test.go github.com/quic-go/quic-go unknownPacketHandler" -//go:generate sh -c "./mockgen_private.sh quic mock_packet_handler_manager_test.go github.com/quic-go/quic-go packetHandlerManager" -//go:generate sh -c "./mockgen_private.sh quic mock_multiplexer_test.go github.com/quic-go/quic-go multiplexer" -//go:generate sh -c "./mockgen_private.sh quic mock_batch_conn_test.go github.com/quic-go/quic-go batchConn" -//go:generate sh -c "go run github.com/golang/mock/mockgen -package quic -self_package github.com/quic-go/quic-go -destination mock_token_store_test.go github.com/quic-go/quic-go TokenStore" -//go:generate sh -c "go run github.com/golang/mock/mockgen -package quic -self_package github.com/quic-go/quic-go -destination mock_packetconn_test.go net PacketConn" +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_send_conn_test.go github.com/quic-go/quic-go SendConn" +type SendConn = sendConn + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_sender_test.go github.com/quic-go/quic-go Sender" +type Sender = sender + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_stream_internal_test.go github.com/quic-go/quic-go StreamI" +type StreamI = streamI + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_crypto_stream_test.go github.com/quic-go/quic-go CryptoStream" +type CryptoStream = cryptoStream + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_receive_stream_internal_test.go github.com/quic-go/quic-go ReceiveStreamI" +type ReceiveStreamI = receiveStreamI + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_send_stream_internal_test.go github.com/quic-go/quic-go SendStreamI" +type SendStreamI = sendStreamI + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_stream_getter_test.go github.com/quic-go/quic-go StreamGetter" +type StreamGetter = streamGetter + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_stream_sender_test.go github.com/quic-go/quic-go StreamSender" +type StreamSender = streamSender + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_crypto_data_handler_test.go github.com/quic-go/quic-go CryptoDataHandler" +type CryptoDataHandler = cryptoDataHandler + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_frame_source_test.go github.com/quic-go/quic-go FrameSource" +type FrameSource = frameSource + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_ack_frame_source_test.go github.com/quic-go/quic-go AckFrameSource" +type AckFrameSource = ackFrameSource + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_stream_manager_test.go github.com/quic-go/quic-go StreamManager" +type StreamManager = streamManager + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_sealing_manager_test.go github.com/quic-go/quic-go SealingManager" +type SealingManager = sealingManager + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_unpacker_test.go github.com/quic-go/quic-go Unpacker" +type Unpacker = unpacker + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_packer_test.go github.com/quic-go/quic-go Packer" +type Packer = packer + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_mtu_discoverer_test.go github.com/quic-go/quic-go MTUDiscoverer" +type MTUDiscoverer = mtuDiscoverer + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_conn_runner_test.go github.com/quic-go/quic-go ConnRunner" +type ConnRunner = connRunner + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_quic_conn_test.go github.com/quic-go/quic-go QUICConn" +type QUICConn = quicConn + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_packet_handler_test.go github.com/quic-go/quic-go PacketHandler" +type PacketHandler = packetHandler + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_unknown_packet_handler_test.go github.com/quic-go/quic-go UnknownPacketHandler" +type UnknownPacketHandler = unknownPacketHandler + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_packet_handler_manager_test.go github.com/quic-go/quic-go PacketHandlerManager" +type PacketHandlerManager = packetHandlerManager + +//go:generate sh -c "go run github.com/golang/mock/mockgen -build_flags=\"-tags=gomock\" -package quic -self_package github.com/quic-go/quic-go -destination mock_multiplexer_test.go github.com/quic-go/quic-go Multiplexer" +type Multiplexer = multiplexer + +// Need to use source mode for the batchConn, since reflect mode follows type aliases. +// See https://github.com/golang/mock/issues/244 for details. +// +//go:generate sh -c "go run github.com/golang/mock/mockgen -package quic -self_package github.com/quic-go/quic-go -source sys_conn_oob.go -destination mock_batch_conn_test.go -mock_names batchConn=MockBatchConn" + +//go:generate sh -c "go run github.com/golang/mock/mockgen -package quic -self_package github.com/quic-go/quic-go -self_package github.com/quic-go/quic-go -destination mock_token_store_test.go github.com/quic-go/quic-go TokenStore" +//go:generate sh -c "go run github.com/golang/mock/mockgen -package quic -self_package github.com/quic-go/quic-go -self_package github.com/quic-go/quic-go -destination mock_packetconn_test.go net PacketConn" diff --git a/mockgen_private.sh b/mockgen_private.sh deleted file mode 100755 index 79f63eee..00000000 --- a/mockgen_private.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -DEST=$2 -PACKAGE=$3 -TMPFILE="mockgen_tmp.go" -# uppercase the name of the interface -ORIG_INTERFACE_NAME=$4 -INTERFACE_NAME="$(tr '[:lower:]' '[:upper:]' <<< ${ORIG_INTERFACE_NAME:0:1})${ORIG_INTERFACE_NAME:1}" - -# Gather all files that contain interface definitions. -# These interfaces might be used as embedded interfaces, -# so we need to pass them to mockgen as aux_files. -AUX=() -for f in *.go; do - if [[ -z ${f##*_test.go} ]]; then - # skip test files - continue; - fi - if $(egrep -qe "type (.*) interface" $f); then - AUX+=("github.com/quic-go/quic-go=$f") - fi -done - -# Find the file that defines the interface we're mocking. -for f in *.go; do - if [[ -z ${f##*_test.go} ]]; then - # skip test files - continue; - fi - INTERFACE=$(sed -n "/^type $ORIG_INTERFACE_NAME interface/,/^}/p" $f) - if [[ -n "$INTERFACE" ]]; then - SRC=$f - break - fi -done - -if [[ -z "$INTERFACE" ]]; then - echo "Interface $ORIG_INTERFACE_NAME not found." - exit 1 -fi - -AUX_FILES=$(IFS=, ; echo "${AUX[*]}") - -## create a public alias for the interface, so that mockgen can process it -echo -e "package $1\n" > $TMPFILE -echo "$INTERFACE" | sed "s/$ORIG_INTERFACE_NAME/$INTERFACE_NAME/" >> $TMPFILE -go run github.com/golang/mock/mockgen -package $1 -self_package $3 -destination $DEST -source=$TMPFILE -aux_files $AUX_FILES -sed "s/$TMPFILE/$SRC/" "$DEST" > "$DEST.new" && mv "$DEST.new" "$DEST" -rm "$TMPFILE" diff --git a/server_test.go b/server_test.go index 45b753bd..e2c801e9 100644 --- a/server_test.go +++ b/server_test.go @@ -267,7 +267,7 @@ var _ = Describe("Server", func() { return true }) tracer.EXPECT().TracerForConnection(gomock.Any(), protocol.PerspectiveServer, protocol.ParseConnectionID([]byte{0xde, 0xad, 0xc0, 0xde})) - conn := NewMockQuicConn(mockCtrl) + conn := NewMockQUICConn(mockCtrl) serv.newConn = func( _ sendConn, _ connRunner, @@ -463,7 +463,7 @@ var _ = Describe("Server", func() { }) tracer.EXPECT().TracerForConnection(gomock.Any(), protocol.PerspectiveServer, protocol.ParseConnectionID([]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10})) - conn := NewMockQuicConn(mockCtrl) + conn := NewMockQUICConn(mockCtrl) serv.newConn = func( _ sendConn, _ connRunner, @@ -542,7 +542,7 @@ var _ = Describe("Server", func() { ) quicConn { <-acceptConn atomic.AddUint32(&counter, 1) - conn := NewMockQuicConn(mockCtrl) + conn := NewMockQUICConn(mockCtrl) conn.EXPECT().handlePacket(gomock.Any()).MaxTimes(1) conn.EXPECT().run().MaxTimes(1) conn.EXPECT().Context().Return(context.Background()).MaxTimes(1) @@ -574,7 +574,7 @@ var _ = Describe("Server", func() { It("only creates a single connection for a duplicate Initial", func() { var createdConn bool - conn := NewMockQuicConn(mockCtrl) + conn := NewMockQUICConn(mockCtrl) serv.newConn = func( _ sendConn, runner connRunner, @@ -622,7 +622,7 @@ var _ = Describe("Server", func() { _ utils.Logger, _ protocol.VersionNumber, ) quicConn { - conn := NewMockQuicConn(mockCtrl) + conn := NewMockQUICConn(mockCtrl) conn.EXPECT().handlePacket(gomock.Any()) conn.EXPECT().run() conn.EXPECT().Context().Return(context.Background()) @@ -673,7 +673,7 @@ var _ = Describe("Server", func() { p := getInitial(protocol.ParseConnectionID([]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10})) ctx, cancel := context.WithCancel(context.Background()) connCreated := make(chan struct{}) - conn := NewMockQuicConn(mockCtrl) + conn := NewMockQUICConn(mockCtrl) serv.newConn = func( _ sendConn, runner connRunner, @@ -961,7 +961,7 @@ var _ = Describe("Server", func() { }) It("accepts new connections when the handshake completes", func() { - conn := NewMockQuicConn(mockCtrl) + conn := NewMockQUICConn(mockCtrl) done := make(chan struct{}) go func() { @@ -1034,7 +1034,7 @@ var _ = Describe("Server", func() { }) It("accepts new connections when they become ready", func() { - conn := NewMockQuicConn(mockCtrl) + conn := NewMockQUICConn(mockCtrl) done := make(chan struct{}) go func() { @@ -1107,7 +1107,7 @@ var _ = Describe("Server", func() { ) quicConn { ready := make(chan struct{}) close(ready) - conn := NewMockQuicConn(mockCtrl) + conn := NewMockQUICConn(mockCtrl) conn.EXPECT().handlePacket(gomock.Any()) conn.EXPECT().run() conn.EXPECT().earlyConnReady().Return(ready) @@ -1148,7 +1148,7 @@ var _ = Describe("Server", func() { p := getInitial(protocol.ParseConnectionID([]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10})) ctx, cancel := context.WithCancel(context.Background()) connCreated := make(chan struct{}) - conn := NewMockQuicConn(mockCtrl) + conn := NewMockQUICConn(mockCtrl) serv.newConn = func( _ sendConn, runner connRunner,