packet

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2018 License: AGPL-3.0 Imports: 3 Imported by: 8

Documentation

Overview

Package packet provides functionalities for building, encoding and decoding data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder struct {
	TagSet
	// contains filtered or unexported fields
}

func NewDecoder

func NewDecoder(r io.Reader, t TagSet) *Decoder

func (*Decoder) Decode

func (d *Decoder) Decode(packet *Packet) error

type Encoder

type Encoder struct {
	TagSet
	// contains filtered or unexported fields
}

func NewEncoder

func NewEncoder(w io.Writer, t TagSet) *Encoder

func (*Encoder) Encode

func (e *Encoder) Encode(p *Packet) error

type Metadata added in v0.5.0

type Metadata struct {
	Encoding    uint8
	Compression uint8
	Encryption  uint8
}

type Module

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

func NewModule

func NewModule(id string, payload []byte) (*Module, error)

func (*Module) ID

func (m *Module) ID() string

func (*Module) Payload

func (m *Module) Payload() []byte

type ModuleDecoder

type ModuleDecoder struct {
	TagSet
	// contains filtered or unexported fields
}

func NewModuleDecoder

func NewModuleDecoder(r io.Reader, t TagSet) *ModuleDecoder

func (*ModuleDecoder) Decode

func (d *ModuleDecoder) Decode(m *Module) error

type ModuleEncoder

type ModuleEncoder struct {
	TagSet
	// contains filtered or unexported fields
}

func NewModuleEncoder

func NewModuleEncoder(w io.Writer, t TagSet) *ModuleEncoder

func (*ModuleEncoder) Encode

func (e *ModuleEncoder) Encode(m *Module) error

type Packet

type Packet struct {
	M Metadata
	// contains filtered or unexported fields
}

func New

func New() *Packet

func (*Packet) AddModule

func (p *Packet) AddModule(id string, payload []byte) (*Module, error)

func (*Packet) DelModule

func (p *Packet) DelModule(id string) error

func (*Packet) Module

func (p *Packet) Module(id string) (*Module, error)

type TagReader

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

func NewTagReader

func NewTagReader(r io.Reader, tag string) *TagReader

func (*TagReader) Flush

func (t *TagReader) Flush() error

func (*TagReader) Read

func (t *TagReader) Read(p []byte) (int, error)

type TagSet

type TagSet struct {
	PacketOpeningTag string
	PacketClosingTag string
	ModuleOpeningTag string
	ModuleClosingTag string
	Separator        string
}

type TagWriter

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

func NewTagWriter

func NewTagWriter(w io.Writer) *TagWriter

func (*TagWriter) Write

func (w *TagWriter) Write(tag string) (int, error)

Jump to

Keyboard shortcuts

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