github.com/MerlinKodo/quic-go@v0.39.2/internal/mocks/logging/tracer.go (about)

     1  //go:build !gomock && !generate
     2  
     3  package mocklogging
     4  
     5  import (
     6  	"net"
     7  
     8  	"github.com/MerlinKodo/quic-go/internal/mocks/logging/internal"
     9  	"github.com/MerlinKodo/quic-go/logging"
    10  
    11  	"go.uber.org/mock/gomock"
    12  )
    13  
    14  type MockTracer = internal.MockTracer
    15  
    16  func NewMockTracer(ctrl *gomock.Controller) (*logging.Tracer, *MockTracer) {
    17  	t := internal.NewMockTracer(ctrl)
    18  	return &logging.Tracer{
    19  		SentPacket: func(remote net.Addr, hdr *logging.Header, size logging.ByteCount, frames []logging.Frame) {
    20  			t.SentPacket(remote, hdr, size, frames)
    21  		},
    22  		SentVersionNegotiationPacket: func(remote net.Addr, dest, src logging.ArbitraryLenConnectionID, versions []logging.VersionNumber) {
    23  			t.SentVersionNegotiationPacket(remote, dest, src, versions)
    24  		},
    25  		DroppedPacket: func(remote net.Addr, typ logging.PacketType, size logging.ByteCount, reason logging.PacketDropReason) {
    26  			t.DroppedPacket(remote, typ, size, reason)
    27  		},
    28  	}, t
    29  }