package quicwire

import "golang.org/x/net/internal/quic/quicwire"

Package quicwire encodes and decode QUIC/HTTP3 wire encoding types, particularly variable-length integers.

Index

Constants

const (
	MaxVarintSize = 8 // encoded size in bytes
	MaxVarint     = (1 << 62) - 1
)

Functions

func AppendUint8Bytes

func AppendUint8Bytes(b, v []byte) []byte

AppendUint8Bytes appends a sequence of bytes prefixed by an 8-bit length.

func AppendVarint

func AppendVarint(b []byte, v uint64) []byte

AppendVarint appends a variable-length integer to b.

https://www.rfc-editor.org/rfc/rfc9000.html#section-16

func AppendVarintBytes

func AppendVarintBytes(b, v []byte) []byte

AppendVarintBytes appends a sequence of bytes prefixed by a variable-length integer length.

func ConsumeUint32

func ConsumeUint32(b []byte) (uint32, int)

ConsumeUint32 parses a 32-bit fixed-length, big-endian integer, reporting its length. It returns a negative length upon an error.

func ConsumeUint64

func ConsumeUint64(b []byte) (uint64, int)

ConsumeUint64 parses a 64-bit fixed-length, big-endian integer, reporting its length. It returns a negative length upon an error.

func ConsumeUint8Bytes

func ConsumeUint8Bytes(b []byte) ([]byte, int)

ConsumeUint8Bytes parses a sequence of bytes prefixed with an 8-bit length, reporting the total number of bytes consumed. It returns a negative length upon an error.

func ConsumeVarint

func ConsumeVarint(b []byte) (v uint64, n int)

ConsumeVarint parses a variable-length integer, reporting its length. It returns a negative length upon an error.

https://www.rfc-editor.org/rfc/rfc9000.html#section-16

func ConsumeVarintBytes

func ConsumeVarintBytes(b []byte) ([]byte, int)

ConsumeVarintBytes parses a sequence of bytes preceded by a variable-length integer length, reporting the total number of bytes consumed. It returns a negative length upon an error.

func ConsumeVarintInt64

func ConsumeVarintInt64(b []byte) (v int64, n int)

consumeVarintInt64 parses a variable-length integer as an int64.

func SizeVarint

func SizeVarint(v uint64) int

SizeVarint returns the size of the variable-length integer encoding of f.

Source Files

wire.go

Version
v0.35.0 (latest)
Published
Feb 10, 2025
Platform
linux/amd64
Imports
1 packages
Last checked
6 hours ago

Tools for package owners.