Documentation ¶
Overview ¶
Package tlv implements a tag-length-value encoding scheme for use in packing flat data structures with a fixed format. Bytes are encoded in big-endian format. Currently supports serialising the integer types and byte slices.
Index ¶
Constants ¶
View Source
const ( // TagUint8indicates a single byte. TagUint8 byte = iota + 1 // TagInt8 indicates a signed byte. TagInt8 // TagBytes indicates a variable length byte sequence. TagBytes // TagInt16 indicates a 16-bit signed integer. TagInt16 // TagUint16 indicates a 16-bit unsigned integer. TagUint16 // TagInt32 indicates a 32-bit signed integer. TagInt32 // TagUint32 indicates a 32-bit unsigned integer. TagUint32 // TagInt64 indicates a 64-bit signed integer. TagInt64 // TagUint64 indicates a 64-bit signed integer. TagUint64 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
A Decoder parses a TLV-encoded structure.
func NewDecoder ¶
NewDecoder creates a decoder from a byte slice.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder is used to serialise values.
func NewFixedEncoder ¶
NewFixedEncoder creates a new encoder with a fixed initial size.
func (*Encoder) Encode ¶
Encode writes a value into the TLV. Note that this cannot be used to write messages or signatures.
Click to show internal directories.
Click to hide internal directories.