github.com/apernet/quic-go@v0.43.1-0.20240515053213-5e9e635fd9f0/internal/mocks/logging/mockgen.go (about)

     1  //go:build gomock || generate
     2  
     3  package mocklogging
     4  
     5  import (
     6  	"net"
     7  	"time"
     8  
     9  	"github.com/apernet/quic-go/logging"
    10  )
    11  
    12  //go:generate sh -c "go run go.uber.org/mock/mockgen -typed -build_flags=\"-tags=gomock\" -package internal -destination internal/tracer.go github.com/apernet/quic-go/internal/mocks/logging Tracer"
    13  type Tracer interface {
    14  	SentPacket(net.Addr, *logging.Header, logging.ByteCount, []logging.Frame)
    15  	SentVersionNegotiationPacket(_ net.Addr, dest, src logging.ArbitraryLenConnectionID, _ []logging.VersionNumber)
    16  	DroppedPacket(net.Addr, logging.PacketType, logging.ByteCount, logging.PacketDropReason)
    17  	Debug(name, msg string)
    18  	Close()
    19  }
    20  
    21  //go:generate sh -c "go run go.uber.org/mock/mockgen -typed -build_flags=\"-tags=gomock\" -package internal -destination internal/connection_tracer.go github.com/apernet/quic-go/internal/mocks/logging ConnectionTracer"
    22  type ConnectionTracer interface {
    23  	StartedConnection(local, remote net.Addr, srcConnID, destConnID logging.ConnectionID)
    24  	NegotiatedVersion(chosen logging.VersionNumber, clientVersions, serverVersions []logging.VersionNumber)
    25  	ClosedConnection(error)
    26  	SentTransportParameters(*logging.TransportParameters)
    27  	ReceivedTransportParameters(*logging.TransportParameters)
    28  	RestoredTransportParameters(parameters *logging.TransportParameters) // for 0-RTT
    29  	SentLongHeaderPacket(*logging.ExtendedHeader, logging.ByteCount, logging.ECN, *logging.AckFrame, []logging.Frame)
    30  	SentShortHeaderPacket(*logging.ShortHeader, logging.ByteCount, logging.ECN, *logging.AckFrame, []logging.Frame)
    31  	ReceivedVersionNegotiationPacket(dest, src logging.ArbitraryLenConnectionID, _ []logging.VersionNumber)
    32  	ReceivedRetry(*logging.Header)
    33  	ReceivedLongHeaderPacket(*logging.ExtendedHeader, logging.ByteCount, logging.ECN, []logging.Frame)
    34  	ReceivedShortHeaderPacket(*logging.ShortHeader, logging.ByteCount, logging.ECN, []logging.Frame)
    35  	BufferedPacket(logging.PacketType, logging.ByteCount)
    36  	DroppedPacket(logging.PacketType, logging.PacketNumber, logging.ByteCount, logging.PacketDropReason)
    37  	UpdatedMetrics(rttStats *logging.RTTStats, cwnd, bytesInFlight logging.ByteCount, packetsInFlight int)
    38  	AcknowledgedPacket(logging.EncryptionLevel, logging.PacketNumber)
    39  	LostPacket(logging.EncryptionLevel, logging.PacketNumber, logging.PacketLossReason)
    40  	UpdatedCongestionState(logging.CongestionState)
    41  	UpdatedPTOCount(value uint32)
    42  	UpdatedKeyFromTLS(logging.EncryptionLevel, logging.Perspective)
    43  	UpdatedKey(generation logging.KeyPhase, remote bool)
    44  	DroppedEncryptionLevel(logging.EncryptionLevel)
    45  	DroppedKey(generation logging.KeyPhase)
    46  	SetLossTimer(logging.TimerType, logging.EncryptionLevel, time.Time)
    47  	LossTimerExpired(logging.TimerType, logging.EncryptionLevel)
    48  	LossTimerCanceled()
    49  	ECNStateUpdated(state logging.ECNState, trigger logging.ECNStateTrigger)
    50  	ChoseALPN(protocol string)
    51  	// Close is called when the connection is closed.
    52  	Close()
    53  	Debug(name, msg string)
    54  }