qpack

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2020 License: MIT Imports: 6 Imported by: 0

README

QPACK

Godoc Reference CircleCI Build Status Code Coverage

This is a minimal QPACK implementation in Go. It is minimal in the sense that it doesn't use the dynamic table at all, but just the static table and (Huffman encoded) string literals. Wherever possible, it reuses code from the HPACK implementation in the Go standard library.

It should be able to interoperate with other QPACK implemetations (both encoders and decoders), however it won't achieve a high compression efficiency.

Running the interop tests

Install the QPACK interop files by running

git submodule update --init --recursive

Then run the tests:

ginkgo -r integrationtests

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

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

A Decoder is the decoding context for incremental processing of header blocks.

func NewDecoder

func NewDecoder(emitFunc func(f HeaderField)) *Decoder

NewDecoder returns a new decoder The emitFunc will be called for each valid field parsed, in the same goroutine as calls to Write, before Write returns.

func (*Decoder) Close

func (d *Decoder) Close() error

Close declares that the decoding is complete and resets the Decoder to be reused again for a new header block. If there is any remaining data in the decoder's buffer, Close returns an error.

func (*Decoder) DecodeFull

func (d *Decoder) DecodeFull(p []byte) ([]HeaderField, error)

DecodeFull decodes an entire block.

func (*Decoder) Write

func (d *Decoder) Write(p []byte) (int, error)

type Encoder

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

An Encoder performs QPACK encoding.

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

NewEncoder returns a new Encoder which performs QPACK encoding. An encoded data is written to w.

func (*Encoder) Close

func (e *Encoder) Close() error

Close declares that the encoding is complete and resets the Encoder to be reused again for a new header block.

func (*Encoder) WriteField

func (e *Encoder) WriteField(f HeaderField) error

WriteField encodes f into a single Write to e's underlying Writer. This function may also produce bytes for the Header Block Prefix if necessary. If produced, it is done before encoding f.

type HeaderField

type HeaderField struct {
	Name  string
	Value string
}

A HeaderField is a name-value pair. Both the name and value are treated as opaque sequences of octets.

func (HeaderField) IsPseudo

func (hf HeaderField) IsPseudo() bool

IsPseudo reports whether the header field is an HTTP3 pseudo header. That is, it reports whether it starts with a colon. It is not otherwise guaranteed to be a valid pseudo header field, though.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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