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

     1  package logging
     2  
     3  // PacketType is the packet type of a QUIC packet
     4  type PacketType uint8
     5  
     6  const (
     7  	// PacketTypeInitial is the packet type of an Initial packet
     8  	PacketTypeInitial PacketType = iota
     9  	// PacketTypeHandshake is the packet type of a Handshake packet
    10  	PacketTypeHandshake
    11  	// PacketTypeRetry is the packet type of a Retry packet
    12  	PacketTypeRetry
    13  	// PacketType0RTT is the packet type of a 0-RTT packet
    14  	PacketType0RTT
    15  	// PacketTypeVersionNegotiation is the packet type of a Version Negotiation packet
    16  	PacketTypeVersionNegotiation
    17  	// PacketType1RTT is a 1-RTT packet
    18  	PacketType1RTT
    19  	// PacketTypeStatelessReset is a stateless reset
    20  	PacketTypeStatelessReset
    21  	// PacketTypeNotDetermined is the packet type when it could not be determined
    22  	PacketTypeNotDetermined
    23  )
    24  
    25  type PacketLossReason uint8
    26  
    27  const (
    28  	// PacketLossReorderingThreshold: when a packet is deemed lost due to reordering threshold
    29  	PacketLossReorderingThreshold PacketLossReason = iota
    30  	// PacketLossTimeThreshold: when a packet is deemed lost due to time threshold
    31  	PacketLossTimeThreshold
    32  )
    33  
    34  type PacketDropReason uint8
    35  
    36  const (
    37  	// PacketDropKeyUnavailable is used when a packet is dropped because keys are unavailable
    38  	PacketDropKeyUnavailable PacketDropReason = iota
    39  	// PacketDropUnknownConnectionID is used when a packet is dropped because the connection ID is unknown
    40  	PacketDropUnknownConnectionID
    41  	// PacketDropHeaderParseError is used when a packet is dropped because header parsing failed
    42  	PacketDropHeaderParseError
    43  	// PacketDropPayloadDecryptError is used when a packet is dropped because decrypting the payload failed
    44  	PacketDropPayloadDecryptError
    45  	// PacketDropProtocolViolation is used when a packet is dropped due to a protocol violation
    46  	PacketDropProtocolViolation
    47  	// PacketDropDOSPrevention is used when a packet is dropped to mitigate a DoS attack
    48  	PacketDropDOSPrevention
    49  	// PacketDropUnsupportedVersion is used when a packet is dropped because the version is not supported
    50  	PacketDropUnsupportedVersion
    51  	// PacketDropUnexpectedPacket is used when an unexpected packet is received
    52  	PacketDropUnexpectedPacket
    53  	// PacketDropUnexpectedSourceConnectionID is used when a packet with an unexpected source connection ID is received
    54  	PacketDropUnexpectedSourceConnectionID
    55  	// PacketDropUnexpectedVersion is used when a packet with an unexpected version is received
    56  	PacketDropUnexpectedVersion
    57  	// PacketDropDuplicate is used when a duplicate packet is received
    58  	PacketDropDuplicate
    59  )
    60  
    61  // TimerType is the type of the loss detection timer
    62  type TimerType uint8
    63  
    64  const (
    65  	// TimerTypeACK is the timer type for the early retransmit timer
    66  	TimerTypeACK TimerType = iota
    67  	// TimerTypePTO is the timer type for the PTO retransmit timer
    68  	TimerTypePTO
    69  )
    70  
    71  // TimeoutReason is the reason why a connection is closed
    72  type TimeoutReason uint8
    73  
    74  const (
    75  	// TimeoutReasonHandshake is used when the connection is closed due to a handshake timeout
    76  	// This reason is not defined in the qlog draft, but very useful for debugging.
    77  	TimeoutReasonHandshake TimeoutReason = iota
    78  	// TimeoutReasonIdle is used when the connection is closed due to an idle timeout
    79  	// This reason is not defined in the qlog draft, but very useful for debugging.
    80  	TimeoutReasonIdle
    81  )
    82  
    83  type CongestionState uint8
    84  
    85  const (
    86  	// CongestionStateSlowStart is the slow start phase of Reno / Cubic
    87  	CongestionStateSlowStart CongestionState = iota
    88  	// CongestionStateCongestionAvoidance is the slow start phase of Reno / Cubic
    89  	CongestionStateCongestionAvoidance
    90  	// CongestionStateRecovery is the recovery phase of Reno / Cubic
    91  	CongestionStateRecovery
    92  	// CongestionStateApplicationLimited means that the congestion controller is application limited
    93  	CongestionStateApplicationLimited
    94  )
    95  
    96  // ECNState is the state of the ECN state machine (see Appendix A.4 of RFC 9000)
    97  type ECNState uint8
    98  
    99  const (
   100  	// ECNStateTesting is the testing state
   101  	ECNStateTesting ECNState = 1 + iota
   102  	// ECNStateUnknown is the unknown state
   103  	ECNStateUnknown
   104  	// ECNStateFailed is the failed state
   105  	ECNStateFailed
   106  	// ECNStateCapable is the capable state
   107  	ECNStateCapable
   108  )
   109  
   110  // ECNStateTrigger is a trigger for an ECN state transition.
   111  type ECNStateTrigger uint8
   112  
   113  const (
   114  	ECNTriggerNoTrigger ECNStateTrigger = iota
   115  	// ECNFailedNoECNCounts is emitted when an ACK acknowledges ECN-marked packets,
   116  	// but doesn't contain any ECN counts
   117  	ECNFailedNoECNCounts
   118  	// ECNFailedDecreasedECNCounts is emitted when an ACK frame decreases ECN counts
   119  	ECNFailedDecreasedECNCounts
   120  	// ECNFailedLostAllTestingPackets is emitted when all ECN testing packets are declared lost
   121  	ECNFailedLostAllTestingPackets
   122  	// ECNFailedMoreECNCountsThanSent is emitted when an ACK contains more ECN counts than ECN-marked packets were sent
   123  	ECNFailedMoreECNCountsThanSent
   124  	// ECNFailedTooFewECNCounts is emitted when an ACK contains fewer ECN counts than it acknowledges packets
   125  	ECNFailedTooFewECNCounts
   126  	// ECNFailedManglingDetected is emitted when the path marks all ECN-marked packets as CE
   127  	ECNFailedManglingDetected
   128  )