coder

package
v3.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 5 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	MessageLength13Base = 13
	MessageLength14Base = 269
	MessageLength15Base = 65805
)

Variables

View Source
var (
	ErrMessageTruncated      = errors.New("message is truncated")
	ErrMessageInvalidVersion = errors.New("message has invalid version")
	ErrMessageTooLong        = errors.New("message length exceeds supported maximum")
)
View Source
var DefaultCoder = new(Coder)

Functions

This section is empty.

Types

type Coder

type Coder struct{}

func (*Coder) Decode

func (c *Coder) Decode(data []byte, m *message.Message) (int, error)

Decode decodes the first frame in data and returns the number of consumed bytes.

func (*Coder) DecodeHeader

func (c *Coder) DecodeHeader(data []byte, h *MessageHeader) (int, error)

func (*Coder) DecodeWithHeader

func (c *Coder) DecodeWithHeader(data []byte, header MessageHeader, m *message.Message) (int, error)

DecodeWithHeader decodes options and payload from data containing only the current frame's bytes after the header.

func (*Coder) Encode

func (c *Coder) Encode(m message.Message, buf []byte) (int, error)

func (*Coder) Size

func (c *Coder) Size(m message.Message) (int, error)

type MessageHeader

type MessageHeader struct {
	Token         []byte
	Length        uint32
	MessageLength uint32
	Code          codes.Code
}

Jump to

Keyboard shortcuts

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