processing

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxFrameSize = uint64(250000)
)

Variables

This section is empty.

Functions

func ReadFrame

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

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 the protocol 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
}

func NewPonger added in v0.2.0

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

func (*Ponger) Pong added in v0.2.0

func (p *Ponger) Pong()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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