frameparser

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// =============== HTTP3 ===============
	MaxFieldSectionSize Setting = 0x06 // section 7.2.4.1 from RFC 9114

	// =============== Extensions ===============
	// this value should be only 0 or 1, meaning deactivated and activated, respectivelly
	Datagrams Setting = 0x33
	// this value should be only 0 or 1, meaning deactivated and activated, respectivelly
	ExtendedConnect Setting = 0x8

	// =============== QPACK ===============
	QpackMaxTableCapacity = 0x01
	QpackBlockedStreams   = 0x07

	// =============== IANA Rerserved ===============
	H2SettingsIdEnablePush           = 0x2
	H2SettingsIdMaxConcurrentStreams = 0x3
	H2SettingsIdInitialWindowSize    = 0x4
	H2SettingsIdMaxFrameSize         = 0x5
)

Available Settings for SettingsFrame

Variables

This section is empty.

Functions

func StreamTypeExtractor

func StreamTypeExtractor(r io.Reader) (adapter.StreamType, error)

-------------------- STREAM TYPE EXTRACTOR ----------------------

Types

type DataFrame

type DataFrame struct {
	Length uint64
	Data   []byte
}

func (*DataFrame) Decode

func (df *DataFrame) Decode(reader io.Reader) error

func (*DataFrame) Encode

func (df *DataFrame) Encode() ([]byte, error)

-------------------- DATA FRAME OPERATIONS ----------------------

type Frame

type Frame interface {
}

type FrameParser

type FrameParser struct {
	// contains filtered or unexported fields
}

func NewFrameParser

func NewFrameParser(r io.Reader) *FrameParser

frame parser initialization and bindiding with a stream just assuming the stream

func (*FrameParser) ParseNextFrame

func (p *FrameParser) ParseNextFrame() (Frame, error)

read stream and parse multiple frames

type FrameType

type FrameType = uint64
const (
	FrameHeaders  FrameType = 0x01
	FrameData     FrameType = 0x00
	FrameSettings FrameType = 0x04
	FrameGoAway   FrameType = 0x07
)

defining the frame types according to RFC 9114

type GoAwayFrame

type GoAwayFrame struct {
	Length   uint64
	StreamID uint64 // the last stream ID that the server will process
}

func (*GoAwayFrame) Decode

func (g *GoAwayFrame) Decode(reader io.Reader) error

func (*GoAwayFrame) Encode

func (g *GoAwayFrame) Encode() ([]byte, error)

type HeadersFrame

type HeadersFrame struct {
	Length  uint64
	Headers []byte // compressed headers using QPACK
}

NOTE: this frame could have a key-value pair structure instead of just bytes

func NewHeadersFrame

func NewHeadersFrame(q qpack.QpackApi, headers ...qpack.HeaderField) (*HeadersFrame, error)

func (*HeadersFrame) Decode

func (hf *HeadersFrame) Decode(reader io.Reader) error

func (*HeadersFrame) Encode

func (hf *HeadersFrame) Encode() ([]byte, error)

type ReservedFrame

type ReservedFrame struct {
	FrameId FrameType
	Length  uint64
}

func (*ReservedFrame) Decode

func (rf *ReservedFrame) Decode(reader io.Reader) error

func (*ReservedFrame) Encode

func (rf *ReservedFrame) Encode() ([]byte, error)

type Setting

type Setting = uint64

type SettingsFrame

type SettingsFrame struct {
	Length   uint64
	Settings map[Setting]uint64 //key-value pairs for HTTP/3 settings
}

func NewSettingsFrame

func NewSettingsFrame(settings map[Setting]uint64) *SettingsFrame

func (*SettingsFrame) Decode

func (sf *SettingsFrame) Decode(reader io.Reader) error

func (*SettingsFrame) Encode

func (sf *SettingsFrame) Encode() ([]byte, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL