1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-23 02:26:49 -05:00
v2fly/vendor/github.com/lucas-clemente/quic-go/internal/wire/ping_frame.go
2018-11-21 10:49:41 +01:00

34 lines
652 B
Go

package wire
import (
"bytes"
"github.com/lucas-clemente/quic-go/internal/protocol"
)
// A PingFrame is a ping frame
type PingFrame struct{}
// parsePingFrame parses a Ping frame
func parsePingFrame(r *bytes.Reader, version protocol.VersionNumber) (*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
}
// Length of a written frame
func (f *PingFrame) Length(version protocol.VersionNumber) protocol.ByteCount {
return 1
}