File tree Expand file tree Collapse file tree 2 files changed +18
-17
lines changed Expand file tree Collapse file tree 2 files changed +18
-17
lines changed Original file line number Diff line number Diff line change 6
6
7
7
package quic
8
8
9
+ import "fmt"
10
+
9
11
// packetType is a QUIC packet type.
10
12
// https://www.rfc-editor.org/rfc/rfc9000.html#section-17
11
13
type packetType byte
@@ -20,6 +22,22 @@ const (
20
22
packetTypeVersionNegotiation
21
23
)
22
24
25
+ func (p packetType ) String () string {
26
+ switch p {
27
+ case packetTypeInitial :
28
+ return "Initial"
29
+ case packetType0RTT :
30
+ return "0-RTT"
31
+ case packetTypeHandshake :
32
+ return "Handshake"
33
+ case packetTypeRetry :
34
+ return "Retry"
35
+ case packetType1RTT :
36
+ return "1-RTT"
37
+ }
38
+ return fmt .Sprintf ("unknown packet type %v" , byte (p ))
39
+ }
40
+
23
41
// Bits set in the first byte of a packet.
24
42
const (
25
43
headerFormLong = 0x80 // https://www.rfc-editor.org/rfc/rfc9000.html#section-17.2-3.2.1
Original file line number Diff line number Diff line change @@ -9,27 +9,10 @@ package quic
9
9
import (
10
10
"bytes"
11
11
"encoding/hex"
12
- "fmt"
13
12
"strings"
14
13
"testing"
15
14
)
16
15
17
- func (p packetType ) String () string {
18
- switch p {
19
- case packetTypeInitial :
20
- return "Initial"
21
- case packetType0RTT :
22
- return "0-RTT"
23
- case packetTypeHandshake :
24
- return "Handshake"
25
- case packetTypeRetry :
26
- return "Retry"
27
- case packetType1RTT :
28
- return "1-RTT"
29
- }
30
- return fmt .Sprintf ("unknown packet type %v" , byte (p ))
31
- }
32
-
33
16
func TestPacketHeader (t * testing.T ) {
34
17
for _ , test := range []struct {
35
18
name string
You can’t perform that action at this time.
0 commit comments