hpack

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package hpack is an HPACK encoder whose choices follow a browser's (profile.HPACK): which fields enter the dynamic table, which entry a literal's name refers to, and when strings are Huffman-coded. Decoding stays with golang.org/x/net/http2/hpack; only what the client sends is fingerprinted.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

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

Encoder encodes header blocks for one connection. It is not safe for concurrent use; the connection serialises header blocks.

func NewEncoder

func NewEncoder(policy *profile.HPACK) *Encoder

NewEncoder returns an encoder following policy, which must be a valid profile's (profile.Validate requires http2.hpack): there is no default, since how a browser encodes headers must be measured (decision 0008).

func (*Encoder) AppendBlock

func (e *Encoder) AppendBlock(dst []byte, fields []Field) []byte

AppendBlock encodes fields in order and appends the header block to dst.

func (*Encoder) SetPeerTableSize

func (e *Encoder) SetPeerTableSize(size uint32)

SetPeerTableSize applies the peer's SETTINGS_HEADER_TABLE_SIZE, capped by the policy's MaxTableSize. The next block starts with size updates (RFC 7541, 4.2): the smallest size set since the last block if it went below the size then in effect, then the final one. An unchanged size is signalled only under SizeUpdatesAlways.

type Field

type Field struct {
	Name, Value string
}

Field is a header field to encode.

Jump to

Keyboard shortcuts

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