frameconn

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFixedFrameLengthMismatch = errors.New("read frame length mismatch")
View Source
var ErrReadFrameLengthShort = errors.New("read frame length too short")
View Source
var ErrShutdown = fmt.Errorf("frameconn: shutting down")

Functions

func IsPublicFrameType

func IsPublicFrameType(ft uint32) bool

The 4 MSBs of ft are reserved for frameconn.

func PrometheusRegister

func PrometheusRegister(registry prometheus.Registerer) error

Types

type Buffer

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

func (*Buffer) Bytes

func (b *Buffer) Bytes() []byte

func (*Buffer) Free

func (b *Buffer) Free()

type Conn

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

func Wrap

func Wrap(nc timeoutconn.Conn) *Conn

func (*Conn) ReadFrame

func (c *Conn) ReadFrame() (Frame, error)

ReadFrame reads a frame from the connection.

Due to an internal optimization (Readv, specifically), it is not guaranteed that a single call to WriteFrame unblocks a pending ReadFrame on an otherwise idle (empty) connection. The only way to guarantee that all previously written frames can reach the peer's layers on top of frameconn is to send an empty frame (no payload) and to ignore empty frames on the receiving side.

func (*Conn) ResetWriteTimeout added in v0.1.1

func (c *Conn) ResetWriteTimeout() error

func (*Conn) Shutdown

func (c *Conn) Shutdown(deadline time.Time) error

func (*Conn) WriteFrame

func (c *Conn) WriteFrame(payload []byte, frameType uint32) error

type Frame

type Frame struct {
	Header FrameHeader
	Buffer Buffer
}

type FrameHeader

type FrameHeader struct {
	Type       uint32
	PayloadLen uint32
}

func (*FrameHeader) Unmarshal

func (f *FrameHeader) Unmarshal(buf []byte)

Jump to

Keyboard shortcuts

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