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