vl

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxVariableLength           = uint32(0x7FFF_FFFF) // = (1^32-1) >> 1.
	MaxSingleByteVariableLength = 127                 // = 255 >> 1.
	FourByteMarkerMask          = uint32(0x8000_0000) // = 1^31.
)
View Source
const (
	RawValueSizeOneByte   = 1
	RawValueSizeFourBytes = 4
)
View Source
const (
	ErrOverflow = "overflow"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type VariableLength

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

VariableLength is a variable length (size) in accordance to the FastCGI Specification Version 1.1.

func NewFromInteger

func NewFromInteger(n uint) (vl *VariableLength, err error)

NewFromInteger creates a variable length from a specified integer value.

func NewFromStream

func NewFromStream(stream io.Reader) (vl *VariableLength, err error)

NewFromStream reads a variable length from the stream.

func (*VariableLength) RealValue

func (vl *VariableLength) RealValue() (realValue uint32)

RealValue return the real value of the length as an uint32.

func (*VariableLength) Size

func (vl *VariableLength) Size() (bytesCount int)

Size returns the number of bytes required to store the raw value.

func (*VariableLength) ToBytes

func (vl *VariableLength) ToBytes() (ba []byte)

ToBytes returns the bytes storing the variable length (size) in accordance to the FastCGI Specification Version 1.1. In other words, it returns the raw value as an array (slice) of bytes.

Jump to

Keyboard shortcuts

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