interface.go 1.1 KB

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