mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-28 00:09:57 +00:00
TUN-4922: Downgrade quic-go library to 0.20.0
This commit is contained in:
47
vendor/github.com/lucas-clemente/quic-go/packet_packer.go
generated
vendored
47
vendor/github.com/lucas-clemente/quic-go/packet_packer.go
generated
vendored
@@ -20,8 +20,7 @@ type packer interface {
|
||||
PackPacket() (*packedPacket, error)
|
||||
MaybePackProbePacket(protocol.EncryptionLevel) (*packedPacket, error)
|
||||
MaybePackAckPacket(handshakeConfirmed bool) (*packedPacket, error)
|
||||
PackConnectionClose(*qerr.TransportError) (*coalescedPacket, error)
|
||||
PackApplicationClose(*qerr.ApplicationError) (*coalescedPacket, error)
|
||||
PackConnectionClose(*qerr.QuicError) (*coalescedPacket, error)
|
||||
|
||||
SetMaxPacketSize(protocol.ByteCount)
|
||||
PackMTUProbePacket(ping ackhandler.Frame, size protocol.ByteCount) (*packedPacket, error)
|
||||
@@ -204,27 +203,14 @@ func newPacketPacker(
|
||||
}
|
||||
}
|
||||
|
||||
// PackConnectionClose packs a packet that closes the connection with a transport error.
|
||||
func (p *packetPacker) PackConnectionClose(e *qerr.TransportError) (*coalescedPacket, error) {
|
||||
// PackConnectionClose packs a packet that ONLY contains a ConnectionCloseFrame
|
||||
func (p *packetPacker) PackConnectionClose(quicErr *qerr.QuicError) (*coalescedPacket, error) {
|
||||
var reason string
|
||||
// don't send details of crypto errors
|
||||
if !e.ErrorCode.IsCryptoError() {
|
||||
reason = e.ErrorMessage
|
||||
if !quicErr.IsCryptoError() {
|
||||
reason = quicErr.ErrorMessage
|
||||
}
|
||||
return p.packConnectionClose(false, uint64(e.ErrorCode), e.FrameType, reason)
|
||||
}
|
||||
|
||||
// PackApplicationClose packs a packet that closes the connection with an application error.
|
||||
func (p *packetPacker) PackApplicationClose(e *qerr.ApplicationError) (*coalescedPacket, error) {
|
||||
return p.packConnectionClose(true, uint64(e.ErrorCode), 0, e.ErrorMessage)
|
||||
}
|
||||
|
||||
func (p *packetPacker) packConnectionClose(
|
||||
isApplicationError bool,
|
||||
errorCode uint64,
|
||||
frameType uint64,
|
||||
reason string,
|
||||
) (*coalescedPacket, error) {
|
||||
var sealers [4]sealer
|
||||
var hdrs [4]*wire.ExtendedHeader
|
||||
var payloads [4]*payload
|
||||
@@ -235,17 +221,20 @@ func (p *packetPacker) packConnectionClose(
|
||||
if p.perspective == protocol.PerspectiveServer && encLevel == protocol.Encryption0RTT {
|
||||
continue
|
||||
}
|
||||
ccf := &wire.ConnectionCloseFrame{
|
||||
IsApplicationError: isApplicationError,
|
||||
ErrorCode: errorCode,
|
||||
FrameType: frameType,
|
||||
ReasonPhrase: reason,
|
||||
quicErrToSend := quicErr
|
||||
reasonPhrase := reason
|
||||
if encLevel == protocol.EncryptionInitial || encLevel == protocol.EncryptionHandshake {
|
||||
// don't send application errors in Initial or Handshake packets
|
||||
if quicErr.IsApplicationError() {
|
||||
quicErrToSend = qerr.NewError(qerr.ApplicationError, "")
|
||||
reasonPhrase = ""
|
||||
}
|
||||
}
|
||||
// don't send application errors in Initial or Handshake packets
|
||||
if isApplicationError && (encLevel == protocol.EncryptionInitial || encLevel == protocol.EncryptionHandshake) {
|
||||
ccf.IsApplicationError = false
|
||||
ccf.ErrorCode = uint64(qerr.ApplicationErrorErrorCode)
|
||||
ccf.ReasonPhrase = ""
|
||||
ccf := &wire.ConnectionCloseFrame{
|
||||
IsApplicationError: quicErrToSend.IsApplicationError(),
|
||||
ErrorCode: quicErrToSend.ErrorCode,
|
||||
FrameType: quicErrToSend.FrameType,
|
||||
ReasonPhrase: reasonPhrase,
|
||||
}
|
||||
payload := &payload{
|
||||
frames: []ackhandler.Frame{{Frame: ccf}},
|
||||
|
Reference in New Issue
Block a user