use mockgen source mode

This commit is contained in:
Marten Seemann 2021-02-20 09:46:41 +08:00
parent 383f1a6e89
commit efe6d02bef
24 changed files with 146 additions and 111 deletions

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go/internal/ackhandler (interfaces: SentPacketTracker)
// Source: interfaces.go
// Package ackhandler is a generated GoMock package.
package ackhandler

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go/internal/handshake (interfaces: HandshakeRunner)
// Source: interface.go
// Package handshake is a generated GoMock package.
package handshake

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: AckFrameSource)
// Source: packet_packer.go
// 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(arg0 protocol.EncryptionLevel, arg1 bool) *wire.AckFrame {
func (m *MockAckFrameSource) GetAckFrame(encLevel protocol.EncryptionLevel, onlyIfQueued bool) *wire.AckFrame {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetAckFrame", arg0, arg1)
ret := m.ctrl.Call(m, "GetAckFrame", encLevel, onlyIfQueued)
ret0, _ := ret[0].(*wire.AckFrame)
return ret0
}
// GetAckFrame indicates an expected call of GetAckFrame.
func (mr *MockAckFrameSourceMockRecorder) GetAckFrame(arg0, arg1 interface{}) *gomock.Call {
func (mr *MockAckFrameSourceMockRecorder) GetAckFrame(encLevel, onlyIfQueued interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAckFrame", reflect.TypeOf((*MockAckFrameSource)(nil).GetAckFrame), arg0, arg1)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAckFrame", reflect.TypeOf((*MockAckFrameSource)(nil).GetAckFrame), encLevel, onlyIfQueued)
}

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: CryptoDataHandler)
// Source: crypto_stream_manager.go
// Package quic is a generated GoMock package.
package quic

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: CryptoStream)
// Source: crypto_stream.go
// 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(arg0 []byte) (int, error) {
func (m *MockCryptoStream) Write(p []byte) (int, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Write", arg0)
ret := m.ctrl.Call(m, "Write", p)
ret0, _ := ret[0].(int)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Write indicates an expected call of Write.
func (mr *MockCryptoStreamMockRecorder) Write(arg0 interface{}) *gomock.Call {
func (mr *MockCryptoStreamMockRecorder) Write(p interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockCryptoStream)(nil).Write), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockCryptoStream)(nil).Write), p)
}

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: FrameSource)
// Source: packet_packer.go
// Package quic is a generated GoMock package.
package quic

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: Multiplexer)
// Source: multiplexer.go
// 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(arg0 net.PacketConn, arg1 int, arg2 []byte, arg3 logging.Tracer) (packetHandlerManager, error) {
func (m *MockMultiplexer) AddConn(c net.PacketConn, connIDLen int, statelessResetKey []byte, tracer logging.Tracer) (packetHandlerManager, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AddConn", arg0, arg1, arg2, arg3)
ret := m.ctrl.Call(m, "AddConn", c, connIDLen, statelessResetKey, tracer)
ret0, _ := ret[0].(packetHandlerManager)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// AddConn indicates an expected call of AddConn.
func (mr *MockMultiplexerMockRecorder) AddConn(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
func (mr *MockMultiplexerMockRecorder) AddConn(c, connIDLen, statelessResetKey, tracer interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddConn", reflect.TypeOf((*MockMultiplexer)(nil).AddConn), arg0, arg1, arg2, arg3)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddConn", reflect.TypeOf((*MockMultiplexer)(nil).AddConn), c, connIDLen, statelessResetKey, tracer)
}
// RemoveConn mocks base method.

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: Packer)
// Source: packet_packer.go
// Package quic is a generated GoMock package.
package quic
@ -49,18 +49,18 @@ func (mr *MockPackerMockRecorder) HandleTransportParameters(arg0 interface{}) *g
}
// MaybePackAckPacket mocks base method.
func (m *MockPacker) MaybePackAckPacket(arg0 bool) (*packedPacket, error) {
func (m *MockPacker) MaybePackAckPacket(handshakeConfirmed bool) (*packedPacket, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "MaybePackAckPacket", arg0)
ret := m.ctrl.Call(m, "MaybePackAckPacket", handshakeConfirmed)
ret0, _ := ret[0].(*packedPacket)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// MaybePackAckPacket indicates an expected call of MaybePackAckPacket.
func (mr *MockPackerMockRecorder) MaybePackAckPacket(arg0 interface{}) *gomock.Call {
func (mr *MockPackerMockRecorder) MaybePackAckPacket(handshakeConfirmed interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MaybePackAckPacket", reflect.TypeOf((*MockPacker)(nil).MaybePackAckPacket), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MaybePackAckPacket", reflect.TypeOf((*MockPacker)(nil).MaybePackAckPacket), handshakeConfirmed)
}
// MaybePackProbePacket mocks base method.

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: PacketHandlerManager)
// Source: server.go
// Package quic is a generated GoMock package.
package quic

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: PacketHandler)
// Source: server.go
// Package quic is a generated GoMock package.
package quic

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: QuicSession)
// Source: server.go
// Package quic is a generated GoMock package.
package quic
@ -67,7 +67,7 @@ func (mr *MockQuicSessionMockRecorder) AcceptUniStream(arg0 interface{}) *gomock
}
// CloseWithError mocks base method.
func (m *MockQuicSession) CloseWithError(arg0 protocol.ApplicationErrorCode, arg1 string) error {
func (m *MockQuicSession) CloseWithError(arg0 ErrorCode, arg1 string) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CloseWithError", arg0, arg1)
ret0, _ := ret[0].(error)

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: ReceiveStreamI)
// Source: receive_stream.go
// Package quic is a generated GoMock package.
package quic
@ -37,7 +37,7 @@ func (m *MockReceiveStreamI) EXPECT() *MockReceiveStreamIMockRecorder {
}
// CancelRead mocks base method.
func (m *MockReceiveStreamI) CancelRead(arg0 protocol.ApplicationErrorCode) {
func (m *MockReceiveStreamI) CancelRead(arg0 ErrorCode) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "CancelRead", arg0)
}
@ -49,39 +49,39 @@ func (mr *MockReceiveStreamIMockRecorder) CancelRead(arg0 interface{}) *gomock.C
}
// Read mocks base method.
func (m *MockReceiveStreamI) Read(arg0 []byte) (int, error) {
func (m *MockReceiveStreamI) Read(p []byte) (int, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Read", arg0)
ret := m.ctrl.Call(m, "Read", p)
ret0, _ := ret[0].(int)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Read indicates an expected call of Read.
func (mr *MockReceiveStreamIMockRecorder) Read(arg0 interface{}) *gomock.Call {
func (mr *MockReceiveStreamIMockRecorder) Read(p interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockReceiveStreamI)(nil).Read), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockReceiveStreamI)(nil).Read), p)
}
// SetReadDeadline mocks base method.
func (m *MockReceiveStreamI) SetReadDeadline(arg0 time.Time) error {
func (m *MockReceiveStreamI) SetReadDeadline(t time.Time) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SetReadDeadline", arg0)
ret := m.ctrl.Call(m, "SetReadDeadline", t)
ret0, _ := ret[0].(error)
return ret0
}
// SetReadDeadline indicates an expected call of SetReadDeadline.
func (mr *MockReceiveStreamIMockRecorder) SetReadDeadline(arg0 interface{}) *gomock.Call {
func (mr *MockReceiveStreamIMockRecorder) SetReadDeadline(t interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetReadDeadline", reflect.TypeOf((*MockReceiveStreamI)(nil).SetReadDeadline), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetReadDeadline", reflect.TypeOf((*MockReceiveStreamI)(nil).SetReadDeadline), t)
}
// StreamID mocks base method.
func (m *MockReceiveStreamI) StreamID() protocol.StreamID {
func (m *MockReceiveStreamI) StreamID() StreamID {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StreamID")
ret0, _ := ret[0].(protocol.StreamID)
ret0, _ := ret[0].(StreamID)
return ret0
}

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: SealingManager)
// Source: packet_packer.go
// Package quic is a generated GoMock package.
package quic

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: SendConn)
// Source: send_conn.go
// Package quic is a generated GoMock package.
package quic

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: SendStreamI)
// Source: send_stream.go
// Package quic is a generated GoMock package.
package quic
@ -39,7 +39,7 @@ func (m *MockSendStreamI) EXPECT() *MockSendStreamIMockRecorder {
}
// CancelWrite mocks base method.
func (m *MockSendStreamI) CancelWrite(arg0 protocol.ApplicationErrorCode) {
func (m *MockSendStreamI) CancelWrite(arg0 ErrorCode) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "CancelWrite", arg0)
}
@ -79,24 +79,24 @@ func (mr *MockSendStreamIMockRecorder) Context() *gomock.Call {
}
// SetWriteDeadline mocks base method.
func (m *MockSendStreamI) SetWriteDeadline(arg0 time.Time) error {
func (m *MockSendStreamI) SetWriteDeadline(t time.Time) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SetWriteDeadline", arg0)
ret := m.ctrl.Call(m, "SetWriteDeadline", t)
ret0, _ := ret[0].(error)
return ret0
}
// SetWriteDeadline indicates an expected call of SetWriteDeadline.
func (mr *MockSendStreamIMockRecorder) SetWriteDeadline(arg0 interface{}) *gomock.Call {
func (mr *MockSendStreamIMockRecorder) SetWriteDeadline(t interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetWriteDeadline", reflect.TypeOf((*MockSendStreamI)(nil).SetWriteDeadline), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetWriteDeadline", reflect.TypeOf((*MockSendStreamI)(nil).SetWriteDeadline), t)
}
// StreamID mocks base method.
func (m *MockSendStreamI) StreamID() protocol.StreamID {
func (m *MockSendStreamI) StreamID() StreamID {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StreamID")
ret0, _ := ret[0].(protocol.StreamID)
ret0, _ := ret[0].(StreamID)
return ret0
}
@ -107,18 +107,18 @@ func (mr *MockSendStreamIMockRecorder) StreamID() *gomock.Call {
}
// Write mocks base method.
func (m *MockSendStreamI) Write(arg0 []byte) (int, error) {
func (m *MockSendStreamI) Write(p []byte) (int, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Write", arg0)
ret := m.ctrl.Call(m, "Write", p)
ret0, _ := ret[0].(int)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Write indicates an expected call of Write.
func (mr *MockSendStreamIMockRecorder) Write(arg0 interface{}) *gomock.Call {
func (mr *MockSendStreamIMockRecorder) Write(p interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockSendStreamI)(nil).Write), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockSendStreamI)(nil).Write), p)
}
// closeForShutdown mocks base method.
@ -172,16 +172,16 @@ func (mr *MockSendStreamIMockRecorder) hasData() *gomock.Call {
}
// popStreamFrame mocks base method.
func (m *MockSendStreamI) popStreamFrame(arg0 protocol.ByteCount) (*ackhandler.Frame, bool) {
func (m *MockSendStreamI) popStreamFrame(maxBytes protocol.ByteCount) (*ackhandler.Frame, bool) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "popStreamFrame", arg0)
ret := m.ctrl.Call(m, "popStreamFrame", maxBytes)
ret0, _ := ret[0].(*ackhandler.Frame)
ret1, _ := ret[1].(bool)
return ret0, ret1
}
// popStreamFrame indicates an expected call of popStreamFrame.
func (mr *MockSendStreamIMockRecorder) popStreamFrame(arg0 interface{}) *gomock.Call {
func (mr *MockSendStreamIMockRecorder) popStreamFrame(maxBytes interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "popStreamFrame", reflect.TypeOf((*MockSendStreamI)(nil).popStreamFrame), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "popStreamFrame", reflect.TypeOf((*MockSendStreamI)(nil).popStreamFrame), maxBytes)
}

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: Sender)
// Source: send_queue.go
// 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(arg0 *packetBuffer) {
func (m *MockSender) Send(p *packetBuffer) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "Send", arg0)
m.ctrl.Call(m, "Send", p)
}
// Send indicates an expected call of Send.
func (mr *MockSenderMockRecorder) Send(arg0 interface{}) *gomock.Call {
func (mr *MockSenderMockRecorder) Send(p interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockSender)(nil).Send), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockSender)(nil).Send), p)
}
// WouldBlock mocks base method.

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: SessionRunner)
// Source: session.go
// Package quic is a generated GoMock package.
package quic

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: StreamGetter)
// Source: session.go
// Package quic is a generated GoMock package.
package quic

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: StreamI)
// Source: stream.go
// Package quic is a generated GoMock package.
package quic
@ -39,7 +39,7 @@ func (m *MockStreamI) EXPECT() *MockStreamIMockRecorder {
}
// CancelRead mocks base method.
func (m *MockStreamI) CancelRead(arg0 protocol.ApplicationErrorCode) {
func (m *MockStreamI) CancelRead(arg0 ErrorCode) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "CancelRead", arg0)
}
@ -51,7 +51,7 @@ func (mr *MockStreamIMockRecorder) CancelRead(arg0 interface{}) *gomock.Call {
}
// CancelWrite mocks base method.
func (m *MockStreamI) CancelWrite(arg0 protocol.ApplicationErrorCode) {
func (m *MockStreamI) CancelWrite(arg0 ErrorCode) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "CancelWrite", arg0)
}
@ -91,67 +91,67 @@ func (mr *MockStreamIMockRecorder) Context() *gomock.Call {
}
// Read mocks base method.
func (m *MockStreamI) Read(arg0 []byte) (int, error) {
func (m *MockStreamI) Read(p []byte) (int, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Read", arg0)
ret := m.ctrl.Call(m, "Read", p)
ret0, _ := ret[0].(int)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Read indicates an expected call of Read.
func (mr *MockStreamIMockRecorder) Read(arg0 interface{}) *gomock.Call {
func (mr *MockStreamIMockRecorder) Read(p interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockStreamI)(nil).Read), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockStreamI)(nil).Read), p)
}
// SetDeadline mocks base method.
func (m *MockStreamI) SetDeadline(arg0 time.Time) error {
func (m *MockStreamI) SetDeadline(t time.Time) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SetDeadline", arg0)
ret := m.ctrl.Call(m, "SetDeadline", t)
ret0, _ := ret[0].(error)
return ret0
}
// SetDeadline indicates an expected call of SetDeadline.
func (mr *MockStreamIMockRecorder) SetDeadline(arg0 interface{}) *gomock.Call {
func (mr *MockStreamIMockRecorder) SetDeadline(t interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDeadline", reflect.TypeOf((*MockStreamI)(nil).SetDeadline), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetDeadline", reflect.TypeOf((*MockStreamI)(nil).SetDeadline), t)
}
// SetReadDeadline mocks base method.
func (m *MockStreamI) SetReadDeadline(arg0 time.Time) error {
func (m *MockStreamI) SetReadDeadline(t time.Time) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SetReadDeadline", arg0)
ret := m.ctrl.Call(m, "SetReadDeadline", t)
ret0, _ := ret[0].(error)
return ret0
}
// SetReadDeadline indicates an expected call of SetReadDeadline.
func (mr *MockStreamIMockRecorder) SetReadDeadline(arg0 interface{}) *gomock.Call {
func (mr *MockStreamIMockRecorder) SetReadDeadline(t interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetReadDeadline", reflect.TypeOf((*MockStreamI)(nil).SetReadDeadline), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetReadDeadline", reflect.TypeOf((*MockStreamI)(nil).SetReadDeadline), t)
}
// SetWriteDeadline mocks base method.
func (m *MockStreamI) SetWriteDeadline(arg0 time.Time) error {
func (m *MockStreamI) SetWriteDeadline(t time.Time) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SetWriteDeadline", arg0)
ret := m.ctrl.Call(m, "SetWriteDeadline", t)
ret0, _ := ret[0].(error)
return ret0
}
// SetWriteDeadline indicates an expected call of SetWriteDeadline.
func (mr *MockStreamIMockRecorder) SetWriteDeadline(arg0 interface{}) *gomock.Call {
func (mr *MockStreamIMockRecorder) SetWriteDeadline(t interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetWriteDeadline", reflect.TypeOf((*MockStreamI)(nil).SetWriteDeadline), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetWriteDeadline", reflect.TypeOf((*MockStreamI)(nil).SetWriteDeadline), t)
}
// StreamID mocks base method.
func (m *MockStreamI) StreamID() protocol.StreamID {
func (m *MockStreamI) StreamID() StreamID {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "StreamID")
ret0, _ := ret[0].(protocol.StreamID)
ret0, _ := ret[0].(StreamID)
return ret0
}
@ -162,18 +162,18 @@ func (mr *MockStreamIMockRecorder) StreamID() *gomock.Call {
}
// Write mocks base method.
func (m *MockStreamI) Write(arg0 []byte) (int, error) {
func (m *MockStreamI) Write(p []byte) (int, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Write", arg0)
ret := m.ctrl.Call(m, "Write", p)
ret0, _ := ret[0].(int)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Write indicates an expected call of Write.
func (mr *MockStreamIMockRecorder) Write(arg0 interface{}) *gomock.Call {
func (mr *MockStreamIMockRecorder) Write(p interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockStreamI)(nil).Write), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockStreamI)(nil).Write), p)
}
// closeForShutdown mocks base method.
@ -269,16 +269,16 @@ func (mr *MockStreamIMockRecorder) hasData() *gomock.Call {
}
// popStreamFrame mocks base method.
func (m *MockStreamI) popStreamFrame(arg0 protocol.ByteCount) (*ackhandler.Frame, bool) {
func (m *MockStreamI) popStreamFrame(maxBytes protocol.ByteCount) (*ackhandler.Frame, bool) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "popStreamFrame", arg0)
ret := m.ctrl.Call(m, "popStreamFrame", maxBytes)
ret0, _ := ret[0].(*ackhandler.Frame)
ret1, _ := ret[1].(bool)
return ret0, ret1
}
// popStreamFrame indicates an expected call of popStreamFrame.
func (mr *MockStreamIMockRecorder) popStreamFrame(arg0 interface{}) *gomock.Call {
func (mr *MockStreamIMockRecorder) popStreamFrame(maxBytes interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "popStreamFrame", reflect.TypeOf((*MockStreamI)(nil).popStreamFrame), arg0)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "popStreamFrame", reflect.TypeOf((*MockStreamI)(nil).popStreamFrame), maxBytes)
}

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: StreamManager)
// Source: session.go
// Package quic is a generated GoMock package.
package quic

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: StreamSender)
// Source: stream.go
// Package quic is a generated GoMock package.
package quic

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: UnknownPacketHandler)
// Source: server.go
// Package quic is a generated GoMock package.
package quic

View file

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/lucas-clemente/quic-go (interfaces: Unpacker)
// Source: session.go
// Package quic is a generated GoMock package.
package quic
@ -36,16 +36,16 @@ func (m *MockUnpacker) EXPECT() *MockUnpackerMockRecorder {
}
// Unpack mocks base method.
func (m *MockUnpacker) Unpack(arg0 *wire.Header, arg1 time.Time, arg2 []byte) (*unpackedPacket, error) {
func (m *MockUnpacker) Unpack(hdr *wire.Header, rcvTime time.Time, data []byte) (*unpackedPacket, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Unpack", arg0, arg1, arg2)
ret := m.ctrl.Call(m, "Unpack", hdr, rcvTime, data)
ret0, _ := ret[0].(*unpackedPacket)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Unpack indicates an expected call of Unpack.
func (mr *MockUnpackerMockRecorder) Unpack(arg0, arg1, arg2 interface{}) *gomock.Call {
func (mr *MockUnpackerMockRecorder) Unpack(hdr, rcvTime, data interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unpack", reflect.TypeOf((*MockUnpacker)(nil).Unpack), arg0, arg1, arg2)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unpack", reflect.TypeOf((*MockUnpacker)(nil).Unpack), hdr, rcvTime, data)
}

View file

@ -1,16 +1,51 @@
#!/bin/bash
DEST=$2
PACKAGE=$3
TMPFILE="mockgen_tmp.go"
# uppercase the name of the interface
INTERFACE_NAME="$(tr '[:lower:]' '[:upper:]' <<< ${4:0:1})${4:1}"
ORIG_INTERFACE_NAME=$4
INTERFACE_NAME="$(tr '[:lower:]' '[:upper:]' <<< ${ORIG_INTERFACE_NAME:0:1})${ORIG_INTERFACE_NAME:1}"
# create a public alias for the interface, so that mockgen can process it
# 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/lucas-clemente/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 "type $INTERFACE_NAME = $4" >> $TMPFILE
mockgen -package $1 -self_package $PACKAGE -destination $2 $PACKAGE $INTERFACE_NAME
mv $2 $TMPFILE && sed 's/qtls.ConnectionState/ConnectionState/g' $TMPFILE > $2
goimports -w $2
rm $TMPFILE
echo "$INTERFACE" | sed "s/$ORIG_INTERFACE_NAME/$INTERFACE_NAME/" >> $TMPFILE
goimports -w $TMPFILE
mockgen -package $1 -self_package $3 -destination $DEST -source=$TMPFILE -aux_files $AUX_FILES
goimports -w $DEST
sed "s/$TMPFILE/$SRC/" "$DEST" > "$DEST.new" && mv "$DEST.new" "$DEST"
rm "$TMPFILE"