Documentation ¶
Overview ¶
Package lob implemnets the Length-Object-Binary encoding (Packet Format).
Reference ¶
https://github.com/telehash/telehash.org/blob/v3/v3/lob/README.md
Index ¶
- Variables
- func Encode(pkt *Packet) (*bufpool.Buffer, error)
- type Header
- func (h *Header) Get(k string) (v interface{}, found bool)
- func (h *Header) GetBool(k string) (v bool, found bool)
- func (h *Header) GetInt(k string) (v int, found bool)
- func (h *Header) GetString(k string) (v string, found bool)
- func (h *Header) GetUint32(k string) (v uint32, found bool)
- func (h *Header) GetUint32Slice(k string) (v []uint32, found bool)
- func (h *Header) IsBinary() bool
- func (h *Header) IsZero() bool
- func (h *Header) Set(k string, v interface{})
- func (h *Header) SetBool(k string, v bool)
- func (h *Header) SetInt(k string, v int)
- func (h *Header) SetString(k string, v string)
- func (h *Header) SetUint32(k string, v uint32)
- func (h *Header) SetUint32Slice(k string, v []uint32)
- type Packet
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidPacket = errors.New("lob: invalid packet")
ErrInvalidPacket is returned by Decode
Functions ¶
Types ¶
type Header ¶
type Header struct { Bytes []byte `json:"-"` C uint32 `json:"c,omitempty"` Type string `json:"type,omitempty"` End bool `json:"end,omitempty"` Seq uint32 `json:"seq,omitempty"` Ack uint32 `json:"ack,omitempty"` Miss []uint32 `json:"miss,omitempty"` HasC bool `json:"-"` HasType bool `json:"-"` HasEnd bool `json:"-"` HasSeq bool `json:"-"` HasAck bool `json:"-"` HasMiss bool `json:"-"` Extra map[string]interface{} `json:"extra,omitempty"` }
Header represents a packet header.
func (*Header) GetBool ¶
GetBool returns the bool value for key k. found is false if k is not present.
func (*Header) GetString ¶
GetString returns the string value for key k. found is false if k is not present.
func (*Header) GetUint32 ¶
GetUint32 returns the uint32 value for key k. found is false if k is not present.
func (*Header) GetUint32Slice ¶
GetUint32Slice returns the []uint32 value for key k. found is false if k is not present.
func (*Header) SetUint32Slice ¶
SetUint32Slice a the header k to v.
Click to show internal directories.
Click to hide internal directories.