TUN-6637: Upgrade go version and quic-go

This commit is contained in:
Sudarsan Reddy
2022-08-08 15:49:10 +01:00
parent 7a9207a6e1
commit 046a30e3c7
219 changed files with 17578 additions and 1040 deletions

View File

@@ -53,10 +53,14 @@ func Is0RTTPacket(b []byte) bool {
if b[0]&0x80 == 0 {
return false
}
if !protocol.IsSupportedVersion(protocol.SupportedVersions, protocol.VersionNumber(binary.BigEndian.Uint32(b[1:5]))) {
version := protocol.VersionNumber(binary.BigEndian.Uint32(b[1:5]))
if !protocol.IsSupportedVersion(protocol.SupportedVersions, version) {
return false
}
return b[0]&0x30>>4 == 0x1
if version == protocol.Version2 {
return b[0]>>4&0b11 == 0b10
}
return b[0]>>4&0b11 == 0b01
}
var ErrUnsupportedVersion = errors.New("unsupported version")
@@ -179,15 +183,28 @@ func (h *Header) parseLongHeader(b *bytes.Reader) error {
return ErrUnsupportedVersion
}
switch (h.typeByte & 0x30) >> 4 {
case 0x0:
h.Type = protocol.PacketTypeInitial
case 0x1:
h.Type = protocol.PacketType0RTT
case 0x2:
h.Type = protocol.PacketTypeHandshake
case 0x3:
h.Type = protocol.PacketTypeRetry
if h.Version == protocol.Version2 {
switch h.typeByte >> 4 & 0b11 {
case 0b00:
h.Type = protocol.PacketTypeRetry
case 0b01:
h.Type = protocol.PacketTypeInitial
case 0b10:
h.Type = protocol.PacketType0RTT
case 0b11:
h.Type = protocol.PacketTypeHandshake
}
} else {
switch h.typeByte >> 4 & 0b11 {
case 0b00:
h.Type = protocol.PacketTypeInitial
case 0b01:
h.Type = protocol.PacketType0RTT
case 0b10:
h.Type = protocol.PacketTypeHandshake
case 0b11:
h.Type = protocol.PacketTypeRetry
}
}
if h.Type == protocol.PacketTypeRetry {