implement packet send modes to determine what kind of packets are sent

This commit is contained in:
Marten Seemann
2018-03-09 17:20:02 +07:00
parent 6a2c4548f7
commit b5977236ff
9 changed files with 205 additions and 92 deletions

View File

@@ -0,0 +1,32 @@
package ackhandler
import "fmt"
// The SendMode says what kind of packets can be sent.
type SendMode uint8
const (
// SendNone means that no packets should be sent
SendNone SendMode = iota
// SendAck means an ACK-only packet should be sent
SendAck
// SendRetransmission means that retransmissions should be sent
SendRetransmission
// SendAny packet should be sent
SendAny
)
func (s SendMode) String() string {
switch s {
case SendNone:
return "none"
case SendAck:
return "ack"
case SendRetransmission:
return "retransmission"
case SendAny:
return "any"
default:
return fmt.Sprintf("invalid send mode: %d", s)
}
}