1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-12-18 08:26:45 +02:00
woodpecker/vendor/github.com/lucas-clemente/quic-go/frames/ping_frame.go
2017-07-24 19:15:25 -04:00

34 lines
633 B
Go

package frames
import (
"bytes"
"github.com/lucas-clemente/quic-go/protocol"
)
// A PingFrame is a ping frame
type PingFrame struct{}
// ParsePingFrame parses a Ping frame
func ParsePingFrame(r *bytes.Reader) (*PingFrame, error) {
frame := &PingFrame{}
_, err := r.ReadByte()
if err != nil {
return nil, err
}
return frame, nil
}
func (f *PingFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error {
typeByte := uint8(0x07)
b.WriteByte(typeByte)
return nil
}
// MinLength of a written frame
func (f *PingFrame) MinLength(version protocol.VersionNumber) (protocol.ByteCount, error) {
return 1, nil
}