github.com/MerlinKodo/quic-go@v0.39.2/internal/wire/retire_connection_id_frame.go (about)

     1  package wire
     2  
     3  import (
     4  	"bytes"
     5  
     6  	"github.com/MerlinKodo/quic-go/internal/protocol"
     7  	"github.com/MerlinKodo/quic-go/quicvarint"
     8  )
     9  
    10  // A RetireConnectionIDFrame is a RETIRE_CONNECTION_ID frame
    11  type RetireConnectionIDFrame struct {
    12  	SequenceNumber uint64
    13  }
    14  
    15  func parseRetireConnectionIDFrame(r *bytes.Reader, _ protocol.VersionNumber) (*RetireConnectionIDFrame, error) {
    16  	seq, err := quicvarint.Read(r)
    17  	if err != nil {
    18  		return nil, err
    19  	}
    20  	return &RetireConnectionIDFrame{SequenceNumber: seq}, nil
    21  }
    22  
    23  func (f *RetireConnectionIDFrame) Append(b []byte, _ protocol.VersionNumber) ([]byte, error) {
    24  	b = append(b, retireConnectionIDFrameType)
    25  	b = quicvarint.Append(b, f.SequenceNumber)
    26  	return b, nil
    27  }
    28  
    29  // Length of a written frame
    30  func (f *RetireConnectionIDFrame) Length(protocol.VersionNumber) protocol.ByteCount {
    31  	return 1 + quicvarint.Len(f.SequenceNumber)
    32  }