github.com/daeuniverse/quic-go@v0.0.0-20240413031024-943f218e0810/internal/ackhandler/send_mode.go (about)

     1  package ackhandler
     2  
     3  import "fmt"
     4  
     5  // The SendMode says what kind of packets can be sent.
     6  type SendMode uint8
     7  
     8  const (
     9  	// SendNone means that no packets should be sent
    10  	SendNone SendMode = iota
    11  	// SendAck means an ACK-only packet should be sent
    12  	SendAck
    13  	// SendPTOInitial means that an Initial probe packet should be sent
    14  	SendPTOInitial
    15  	// SendPTOHandshake means that a Handshake probe packet should be sent
    16  	SendPTOHandshake
    17  	// SendPTOAppData means that an Application data probe packet should be sent
    18  	SendPTOAppData
    19  	// SendPacingLimited means that the pacer doesn't allow sending of a packet right now,
    20  	// but will do in a little while.
    21  	// The timestamp when sending is allowed again can be obtained via the SentPacketHandler.TimeUntilSend.
    22  	SendPacingLimited
    23  	// SendAny means that any packet should be sent
    24  	SendAny
    25  )
    26  
    27  func (s SendMode) String() string {
    28  	switch s {
    29  	case SendNone:
    30  		return "none"
    31  	case SendAck:
    32  		return "ack"
    33  	case SendPTOInitial:
    34  		return "pto (Initial)"
    35  	case SendPTOHandshake:
    36  		return "pto (Handshake)"
    37  	case SendPTOAppData:
    38  		return "pto (Application Data)"
    39  	case SendAny:
    40  		return "any"
    41  	case SendPacingLimited:
    42  		return "pacing limited"
    43  	default:
    44  		return fmt.Sprintf("invalid send mode: %d", s)
    45  	}
    46  }