mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-11-04 03:27:23 -05:00 
			
		
		
		
	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.
		
			
				
	
	
		
			55 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			55 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
package frames
 | 
						|
 | 
						|
import (
 | 
						|
	"bytes"
 | 
						|
 | 
						|
	"github.com/lucas-clemente/quic-go/protocol"
 | 
						|
	"github.com/lucas-clemente/quic-go/utils"
 | 
						|
)
 | 
						|
 | 
						|
// A WindowUpdateFrame in QUIC
 | 
						|
type WindowUpdateFrame struct {
 | 
						|
	StreamID   protocol.StreamID
 | 
						|
	ByteOffset protocol.ByteCount
 | 
						|
}
 | 
						|
 | 
						|
//Write writes a RST_STREAM frame
 | 
						|
func (f *WindowUpdateFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error {
 | 
						|
	typeByte := uint8(0x04)
 | 
						|
	b.WriteByte(typeByte)
 | 
						|
 | 
						|
	utils.WriteUint32(b, uint32(f.StreamID))
 | 
						|
	utils.WriteUint64(b, uint64(f.ByteOffset))
 | 
						|
	return nil
 | 
						|
}
 | 
						|
 | 
						|
// MinLength of a written frame
 | 
						|
func (f *WindowUpdateFrame) MinLength(version protocol.VersionNumber) (protocol.ByteCount, error) {
 | 
						|
	return 1 + 4 + 8, nil
 | 
						|
}
 | 
						|
 | 
						|
// ParseWindowUpdateFrame parses a RST_STREAM frame
 | 
						|
func ParseWindowUpdateFrame(r *bytes.Reader) (*WindowUpdateFrame, error) {
 | 
						|
	frame := &WindowUpdateFrame{}
 | 
						|
 | 
						|
	// read the TypeByte
 | 
						|
	_, err := r.ReadByte()
 | 
						|
	if err != nil {
 | 
						|
		return nil, err
 | 
						|
	}
 | 
						|
 | 
						|
	sid, err := utils.ReadUint32(r)
 | 
						|
	if err != nil {
 | 
						|
		return nil, err
 | 
						|
	}
 | 
						|
	frame.StreamID = protocol.StreamID(sid)
 | 
						|
 | 
						|
	byteOffset, err := utils.ReadUint64(r)
 | 
						|
	if err != nil {
 | 
						|
		return nil, err
 | 
						|
	}
 | 
						|
	frame.ByteOffset = protocol.ByteCount(byteOffset)
 | 
						|
 | 
						|
	return frame, nil
 | 
						|
}
 |