github.com/apernet/quic-go@v0.43.1-0.20240515053213-5e9e635fd9f0/internal/wire/retire_connection_id_frame.go (about) 1 package wire 2 3 import ( 4 "bytes" 5 6 "github.com/apernet/quic-go/internal/protocol" 7 "github.com/apernet/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.Version) (*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.Version) ([]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.Version) protocol.ByteCount { 31 return 1 + protocol.ByteCount(quicvarint.Len(f.SequenceNumber)) 32 }