mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-30 22:34:15 -05:00
6fde3632ef
The vendor/ folder was created with the help of @FiloSottile's gvt and vendorcheck. Any dependencies of Caddy plugins outside this repo are not vendored. We do not remove any unused, vendored packages because vendorcheck -u only checks using the current build configuration; i.e. packages that may be imported by files toggled by build tags of other systems. CI tests have been updated to ignore the vendor/ folder. When Go 1.9 is released, a few of the go commands should be revised to again use ./... as it will ignore the vendor folder by default.
33 lines
633 B
Go
33 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
|
|
}
|