send_mode.go 749 B

123456789101112131415161718192021222324252627282930313233343536
  1. package ackhandler
  2. import "fmt"
  3. // The SendMode says what kind of packets can be sent.
  4. type SendMode uint8
  5. const (
  6. // SendNone means that no packets should be sent
  7. SendNone SendMode = iota
  8. // SendAck means an ACK-only packet should be sent
  9. SendAck
  10. // SendRetransmission means that retransmissions should be sent
  11. SendRetransmission
  12. // SendPTO means that a probe packet should be sent
  13. SendPTO
  14. // SendAny means that any packet should be sent
  15. SendAny
  16. )
  17. func (s SendMode) String() string {
  18. switch s {
  19. case SendNone:
  20. return "none"
  21. case SendAck:
  22. return "ack"
  23. case SendRetransmission:
  24. return "retransmission"
  25. case SendPTO:
  26. return "pto"
  27. case SendAny:
  28. return "any"
  29. default:
  30. return fmt.Sprintf("invalid send mode: %d", s)
  31. }
  32. }