github.com/tumi8/quic-go@v0.37.4-tum/noninternal/wire/path_challenge_frame.go (about) 1 package wire 2 3 import ( 4 "bytes" 5 "io" 6 7 "github.com/tumi8/quic-go/noninternal/protocol" 8 ) 9 10 // A PathChallengeFrame is a PATH_CHALLENGE frame 11 type PathChallengeFrame struct { 12 Data [8]byte 13 } 14 15 func parsePathChallengeFrame(r *bytes.Reader, _ protocol.VersionNumber) (*PathChallengeFrame, error) { 16 frame := &PathChallengeFrame{} 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 *PathChallengeFrame) Append(b []byte, _ protocol.VersionNumber) ([]byte, error) { 27 b = append(b, pathChallengeFrameType) 28 b = append(b, f.Data[:]...) 29 return b, nil 30 } 31 32 // Length of a written frame 33 func (f *PathChallengeFrame) Length(_ protocol.VersionNumber) protocol.ByteCount { 34 return 1 + 8 35 }