-
Notifications
You must be signed in to change notification settings - Fork 5
/
quic_type.go
110 lines (95 loc) · 2.69 KB
/
quic_type.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package tcpip
const (
QuicFrameTypePing = 0x01
QuicFrameTypeACK = 0x02
QuicFrameTypeCrypto = 0x06
QuicFrameTypeNewToken = 0x07
QuicFrameTypeHandShakeDone = 0x1e
)
var initialSalt = []byte{
0x38, 0x76, 0x2c, 0xf7, 0xf5, 0x59, 0x34, 0xb3, 0x4d, 0x17,
0x9a, 0xe6, 0xa4, 0xc8, 0x0c, 0xad, 0xcc, 0xbb, 0x7f, 0x0a,
}
// 固定のラベル
var clientInitialLabel = []byte(`client in`)
var serverInitialLabel = []byte(`server in`)
var quicKeyLabel = []byte(`quic key`)
var quicIVLabel = []byte(`quic iv`)
// hp is for header protection
var quicHPLabel = []byte(`quic hp`)
// Quic Transport Prameters
// 18.2. Transport Parameter Definitions
var initialMaxStreamDataBidiLocal = []byte{0x05, 0x04, 0x80, 0x08, 0x00, 0x00}
var initialMaxStreamDataBidiRemote = []byte{0x06, 0x04, 0x80, 0x08, 0x00, 0x00}
var initialMaxStreamDataUni = []byte{0x07, 0x04, 0x80, 0x08, 0x00, 0x00}
var initialMaxData = []byte{0x04, 0x04, 0x80, 0x0c, 0x00, 0x00}
var initialMaxStreamsBidi = []byte{0x08, 0x01, 0x00}
var initialMaxStreamsUni = []byte{0x09, 0x02, 0x40, 0x64}
var maxIdleTimeout = []byte{0x01, 0x04, 0x80, 0x00, 0x75, 0x30}
var maxUdpPayloadSize = []byte{0x03, 0x02, 0x45, 0xac}
var disableActiveMigration = []byte{0x0c, 0x00}
var activeConnectionIdLimit = []byte{0x0e, 0x01, 0x04}
var initialSourceConnectionId = []byte{0x0f}
var maxDatagramFrameSize = []byte{0x20, 0x01, 0x00}
type QuicKeyBlock struct {
ClientKey []byte
ClientIV []byte
ClientHeaderProtection []byte
ServerKey []byte
ServerIV []byte
ServerHeaderProtection []byte
}
type QuicRawPacket struct {
QuicHeader interface{}
QuicFrames []interface{}
}
type QuicLongCommonHeader struct {
HeaderByte []byte
Version []byte
DestConnIDLength []byte
DestConnID []byte
SourceConnIDLength []byte
SourceConnID []byte
}
//type QuicFrame struct {
// FrameInfo FrameInfo
// Packet interface{}
//}
type FrameInfo struct {
HeaderForm string
FixedBit string
PacketType string
Reserved string
PacketNumberLegnth string
}
type InitialPacket struct {
//CommonHeader QuicLongCommonHeader
TokenLength []byte
Token []byte
Length []byte
PacketNumber []byte
Payload []byte
}
type RetryPacket struct {
RetryToken []byte
RetryIntergrityTag []byte
}
type QuicCryptoFrame struct {
Type []byte
Offset []byte
Length []byte
Data []byte
}
type QuicACKFrame struct {
Type []byte
LargestAcknowledged []byte
AckDelay []byte
AckRangeCount []byte
FirstAckRange []byte
}
type UDPInfo struct {
ClientAddr [4]byte
ClientPort int
ServerAddr [4]byte
ServerPort int
}