protocol

package
v0.0.0-...-3928268 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action uint8
const (
	ActResponse Action = iota
	ActHandshake
	ActLabel
	ActMulticast
)

type Frame

type Frame struct {
	Act     Action
	Label   string
	Payload []byte
}

func NewFrame

func NewFrame() *Frame

func (*Frame) Recycle

func (f *Frame) Recycle()

type FrameDecoder

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

func NewFrameDecoder

func NewFrameDecoder(r io.Reader) *FrameDecoder

func (*FrameDecoder) Decode

func (d *FrameDecoder) Decode(frame *Frame) (raw []byte, err error)

type FrameEncoder

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

func NewFrameEncoder

func NewFrameEncoder(w io.Writer) *FrameEncoder

func (*FrameEncoder) Close

func (e *FrameEncoder) Close() (err error)

func (*FrameEncoder) Encode

func (e *FrameEncoder) Encode(frame *Frame) (err error)

type FrameProcessor

type FrameProcessor struct {
	*FrameEncoder
	*FrameDecoder
}

func NewFrameProcessor

func NewFrameProcessor(rw io.ReadWriter) *FrameProcessor

func (*FrameProcessor) SetDecodeTimeout

func (p *FrameProcessor) SetDecodeTimeout(t time.Duration) error

type Packer

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

func NewPacker

func NewPacker(readFrame func() *Frame) *Packer

func (*Packer) Assemble

func (p *Packer) Assemble() (label string, data [][]byte)

func (*Packer) Pack

func (p *Packer) Pack(label string, data any) <-chan *Frame

Jump to

Keyboard shortcuts

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