quicvarint

package
v0.41.0-19 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Min is the minimum value allowed for a QUIC varint.
	Min = 0

	// Max is the maximum allowed value for a QUIC varint (2^62-1).
	Max = maxVarInt8
)

taken from the QUIC draft

Variables

This section is empty.

Functions

func Append

func Append(b []byte, i uint64) []byte

Append appends i in the QUIC varint format.

func AppendWithLen

func AppendWithLen(b []byte, i uint64, length protocol.ByteCount) []byte

AppendWithLen append i in the QUIC varint format with the desired length.

func Len

func Len(i uint64) protocol.ByteCount

Len determines the number of bytes that will be needed to write the number i.

func Read

func Read(r io.ByteReader) (uint64, error)

Read reads a number in the QUIC varint format from r.

Types

type Reader

type Reader interface {
	io.ByteReader
	io.Reader
}

Reader implements both the io.ByteReader and io.Reader interfaces.

func NewReader

func NewReader(r io.Reader) Reader

NewReader returns a Reader for r. If r already implements both io.ByteReader and io.Reader, NewReader returns r. Otherwise, r is wrapped to add the missing interfaces.

type Writer

type Writer interface {
	io.ByteWriter
	io.Writer
}

Writer implements both the io.ByteWriter and io.Writer interfaces.

func NewWriter

func NewWriter(w io.Writer) Writer

NewWriter returns a Writer for w. If r already implements both io.ByteWriter and io.Writer, NewWriter returns w. Otherwise, w is wrapped to add the missing interfaces.

Jump to

Keyboard shortcuts

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