github.com/sagernet/quic-go@v0.43.1-beta.1/internal/wire/path_response_frame.go (about) 1 package wire 2 3 import ( 4 "bytes" 5 "io" 6 7 "github.com/sagernet/quic-go/internal/protocol" 8 ) 9 10 // A PathResponseFrame is a PATH_RESPONSE frame 11 type PathResponseFrame struct { 12 Data [8]byte 13 } 14 15 func parsePathResponseFrame(r *bytes.Reader, _ protocol.Version) (*PathResponseFrame, error) { 16 frame := &PathResponseFrame{} 17 if _, err := io.ReadFull(r, frame.Data[:]); err != nil { 18 if err == io.ErrUnexpectedEOF { 19 return nil, io.EOF 20 } 21 return nil, err 22 } 23 return frame, nil 24 } 25 26 func (f *PathResponseFrame) Append(b []byte, _ protocol.Version) ([]byte, error) { 27 b = append(b, pathResponseFrameType) 28 b = append(b, f.Data[:]...) 29 return b, nil 30 } 31 32 // Length of a written frame 33 func (f *PathResponseFrame) Length(_ protocol.Version) protocol.ByteCount { 34 return 1 + 8 35 }