mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-01 19:27:35 +03:00
29 lines
940 B
Go
29 lines
940 B
Go
//go:build !gomock && !generate
|
|
|
|
package mocklogging
|
|
|
|
import (
|
|
"net"
|
|
|
|
"github.com/refraction-networking/uquic/internal/mocks/logging/internal"
|
|
"github.com/refraction-networking/uquic/logging"
|
|
|
|
"go.uber.org/mock/gomock"
|
|
)
|
|
|
|
type MockTracer = internal.MockTracer
|
|
|
|
func NewMockTracer(ctrl *gomock.Controller) (*logging.Tracer, *MockTracer) {
|
|
t := internal.NewMockTracer(ctrl)
|
|
return &logging.Tracer{
|
|
SentPacket: func(remote net.Addr, hdr *logging.Header, size logging.ByteCount, frames []logging.Frame) {
|
|
t.SentPacket(remote, hdr, size, frames)
|
|
},
|
|
SentVersionNegotiationPacket: func(remote net.Addr, dest, src logging.ArbitraryLenConnectionID, versions []logging.VersionNumber) {
|
|
t.SentVersionNegotiationPacket(remote, dest, src, versions)
|
|
},
|
|
DroppedPacket: func(remote net.Addr, typ logging.PacketType, size logging.ByteCount, reason logging.PacketDropReason) {
|
|
t.DroppedPacket(remote, typ, size, reason)
|
|
},
|
|
}, t
|
|
}
|