tlv

package
v0.0.0-...-27b3d77 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// PayloadTag is used to indicate the length of the payload.
	PayloadTag = Tag(0xCB)
)

Variables

This section is empty.

Functions

func Encode

func Encode(tlvs ...*TLV) []byte

Encode the TLVs by prefixing a TLV as a header that contains the number of TLVs contained within.

Types

type Reader

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

func NewReader

func NewReader(r io.Reader, opts ...ReaderOption) *Reader

func (*Reader) Header

func (r *Reader) Header() []TLV

func (*Reader) Read

func (r *Reader) Read(p []byte) (n int, err error)

type ReaderOption

type ReaderOption func(*Reader)

func WithBufferSize

func WithBufferSize(size int) ReaderOption

func WithPreserve

func WithPreserve(preserve bool) ReaderOption

type TLV

type TLV struct {
	Tag    Tag
	Length uint32
	Value  []byte
}

func New

func New(tag Tag, value []byte) *TLV

func (*TLV) Encode

func (t *TLV) Encode() []byte

type Tag

type Tag uint16

Jump to

Keyboard shortcuts

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