/
interface.go
50 lines (41 loc) · 1.11 KB
/
interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package quictrace
import (
"time"
"github.com/lucas-clemente/quic-go/internal/protocol"
"github.com/lucas-clemente/quic-go/internal/wire"
)
// A Tracer traces a QUIC connection
type Tracer interface {
Trace(protocol.ConnectionID, Event)
GetAllTraces() map[string][]byte
}
// EventType is the type of an event
type EventType uint8
const (
// PacketSent means that a packet was sent
PacketSent EventType = 1 + iota
// PacketReceived means that a packet was received
PacketReceived
// PacketLost means that a packet was lost
PacketLost
)
// Event is a quic-traceable event
type Event struct {
Time time.Time
EventType EventType
TransportState *TransportState
EncryptionLevel protocol.EncryptionLevel
PacketNumber protocol.PacketNumber
PacketSize protocol.ByteCount
Frames []wire.Frame
}
// TransportState contains some transport and congestion statistics
type TransportState struct {
MinRTT time.Duration
SmoothedRTT time.Duration
LatestRTT time.Duration
BytesInFlight protocol.ByteCount
CongestionWindow protocol.ByteCount
InSlowStart bool
InRecovery bool
}