Documentation
¶
Overview ¶
Package netstring provides the functions to read and write the netstring
Package netstring contains encoding and decoding functions in netstring format
Index ¶
Constants ¶
const (
// CodeSubCommand is a special command used to define that the payload contains multiple netstrings
CodeSubCommand = '0'
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Netstring ¶
type Netstring struct { Cmd int Serialized []byte // the entire netstring array. e.g. "100:1 xxx...yyy," Payload []byte // the content section of a netstring. e.g. "xxx...yyy" }
Netstring is a netstring packed, which consists of a command plus a payload
func NewNetstring ¶
NewNetstring creates a Netstring from the reader, reading exactly as many bytes as necessary
func NewNetstringEmbedded ¶
NewNetstringEmbedded embedds a set of Netstrings into a netstring
func NewNetstringFrom ¶
NewNetstringFrom creates a Netstring from command and Payload
func SubNetstrings ¶
SubNetstrings parses the embedded Netstrings
func (*Netstring) IsComposite ¶
IsComposite returns if the netstring is compisite, embedding multiple netstrings in it
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader decodes netstrings from a buffer
func NewNetstringReader ¶
NewNetstringReader creates a Reader, that maintains the state for embedded Netstrings