Documentation
¶
Index ¶
- Constants
- Variables
- type ControlFrame
- type Frame
- type Fstrm
- func (fs Fstrm) InitReceiver() error
- func (fs Fstrm) InitSender() error
- func (fs Fstrm) ProcessFrame(ch chan []byte) error
- func (fs Fstrm) RecvCompressedFrame(codec compress.Codec, timeout bool) (*Frame, error)
- func (fs Fstrm) RecvControl() (*ControlFrame, error)
- func (fs Fstrm) RecvFrame(timeout bool) (*Frame, error)
- func (fs Fstrm) ResetReceiver(frame *Frame) error
- func (fs Fstrm) ResetSender() error
- func (fs Fstrm) SendCompressedFrame(codec compress.Codec, frame *Frame) (err error)
- func (fs Fstrm) SendControl(control *ControlFrame) (err error)
- func (fs Fstrm) SendFrame(frame *Frame) (err error)
Constants ¶
const CONTROL_ACCEPT = 0x01
const CONTROL_FIELD_CONTENT_TYPE = 0x01
const CONTROL_FINISH = 0x05
const CONTROL_FRAME_LENGTH_MAX = 4064
const CONTROL_READY = 0x04
const CONTROL_START = 0x02
const CONTROL_STOP = 0x03
const DATA_FRAME_LENGTH_MAX = 65536
Variables ¶
var ErrControlFrameContentTypeUnsupported = errors.New("control frame with unsupported content type")
var ErrControlFrameExpected = errors.New("control frame expected")
var ErrControlFrameMalformed = errors.New("control frame malformed")
var ErrControlFrameTooLarge = errors.New("control frame too large error")
var ErrControlFrameUnexpected = errors.New("control frame unexpected")
var ErrControlFrameUnsupported = errors.New("control frame unsupported")
var ErrFrameTooLarge = errors.New("frame too large error")
var ErrReaderNotReady = errors.New("reader not ready")
Functions ¶
This section is empty.
Types ¶
type ControlFrame ¶
type ControlFrame struct {
// contains filtered or unexported fields
}
Control Frame struct
|------------------------------------|----------------------| | Control frame length | 4 bytes | |------------------------------------|----------------------| | Control frame type | 4 bytes | |------------------------------------|----------------------| | Control frame content type | 4 bytes (optional) | |------------------------------------|----------------------| | Control frame content type length | 4 bytes (optional) | |------------------------------------|----------------------| | Content type payload | xx bytes | |------------------------------------|----------------------|
func (*ControlFrame) CheckContentType ¶
func (ctrl *ControlFrame) CheckContentType(ctype []byte) bool
func (*ControlFrame) Decode ¶
func (ctrl *ControlFrame) Decode() error
func (*ControlFrame) Encode ¶
func (ctrl *ControlFrame) Encode() error
type Frame ¶
type Frame struct {
// contains filtered or unexported fields
}
Frame struct
|------------------------------------|----------------------| | Data length | 4 bytes | |------------------------------------|----------------------| | Payload | xx bytes | |------------------------------------|----------------------|
If the data length is equal to zero then it's a control frame otherwise we have a data frame.
func (*Frame) AppendData ¶ added in v0.9.0
type Fstrm ¶
type Fstrm struct {
// contains filtered or unexported fields
}
Framestream
func (Fstrm) InitReceiver ¶
func (Fstrm) InitSender ¶
func (Fstrm) ProcessFrame ¶
func (Fstrm) RecvCompressedFrame ¶ added in v0.8.0
func (Fstrm) RecvControl ¶
func (fs Fstrm) RecvControl() (*ControlFrame, error)
func (Fstrm) ResetReceiver ¶
func (Fstrm) ResetSender ¶
func (Fstrm) SendCompressedFrame ¶ added in v0.8.0
func (Fstrm) SendControl ¶
func (fs Fstrm) SendControl(control *ControlFrame) (err error)