1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-10 19:36:32 -05:00
v2fly/vendor/github.com/lucas-clemente/quic-go/internal/wire/ping_frame.go

34 lines
652 B
Go
Raw Normal View History

2018-11-20 17:51:25 -05:00
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
}