mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-28 20:29:58 +00:00
TUN-6637: Upgrade go version and quic-go
This commit is contained in:
39
vendor/github.com/lucas-clemente/quic-go/internal/wire/header.go
generated
vendored
39
vendor/github.com/lucas-clemente/quic-go/internal/wire/header.go
generated
vendored
@@ -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 {
|
||||
|
Reference in New Issue
Block a user