processing

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxFrameSize is set at 250000 bytes
	MaxFrameSize = uint64(250000)
)

Variables

This section is empty.

Functions

func ReadFrame

func ReadFrame(r io.Reader) (uint64, error)

ReadFrame extract the bytes representing the size of the packet and thus read the amount of bytes specified by such prefix in little endianness

func WriteFrame

func WriteFrame(buf *bytes.Buffer, magic protocol.Magic, cs []byte) error

WriteFrame mutates a buffer by adding a length-prefixing wire message frame at the beginning of the message

Types

type Gossip

type Gossip struct {
	Magic protocol.Magic
}

Gossip is a preprocessor for gossip messages.

func NewGossip

func NewGossip(magic protocol.Magic) *Gossip

NewGossip returns a gossip preprocessor with the specified magic.

func (*Gossip) Process

func (g *Gossip) Process(m *bytes.Buffer) error

Process a message that is passing through, by prepending magic and the message checksum, and finally by prepending the length.

func (*Gossip) UnpackLength added in v0.2.0

func (g *Gossip) UnpackLength(r io.Reader) (uint64, error)

UnpackLength unwraps the incoming packet (likely from a net.Conn struct) and returns the length of the packet without reading the payload (which is left to the user of this method)

type Ponger added in v0.2.0

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

Ponger responds to a Ping on a channel

func NewPonger added in v0.2.0

func NewPonger(responseChan chan<- *bytes.Buffer) Ponger

NewPonger instantiates a new Ponger with a new channel

func (*Ponger) Pong added in v0.2.0

func (p *Ponger) Pong()

Pong pushes a pong buffer to a channel

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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