framestream

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2019 License: Apache-2.0 Imports: 7 Imported by: 109

README

Frame Streams implementation in Go

https://github.com/farsightsec/golang-framestream

Frame Streams is a lightweight, binary-clean protocol that allows for the transport of arbitrarily encoded data payload sequences with minimal framing overhead.

This package provides a pure Golang implementation. The Frame Streams implementation in C is at https://github.com/farsightsec/fstrm/.

The example framestream_dump program reads a Frame Streams formatted input file and prints the data frames and frame byte counts.

Documentation

Index

Constants

View Source
const CONTROL_ACCEPT = 0x01
View Source
const CONTROL_FIELD_CONTENT_TYPE = 0x01
View Source
const CONTROL_FINISH = 0x05
View Source
const CONTROL_READY = 0x04
View Source
const CONTROL_START = 0x02
View Source
const CONTROL_STOP = 0x03
View Source
const DEFAULT_MAX_PAYLOAD_SIZE = 1048576
View Source
const MAX_CONTROL_FRAME_SIZE = 512

Variables

View Source
var ControlAccept = ControlFrame{ControlType: CONTROL_ACCEPT}
View Source
var ControlFinish = ControlFrame{ControlType: CONTROL_FINISH}
View Source
var ControlReady = ControlFrame{ControlType: CONTROL_READY}
View Source
var ControlStart = ControlFrame{ControlType: CONTROL_START}
View Source
var ControlStop = ControlFrame{ControlType: CONTROL_STOP}
View Source
var EOF = io.EOF
View Source
var ErrContentTypeMismatch = errors.New("content type mismatch")
View Source
var ErrDataFrameTooLarge = errors.New("data frame too large")
View Source
var ErrDecode = errors.New("decoding error")
View Source
var ErrShortRead = errors.New("short read")
View Source
var ErrType = errors.New("invalid type")

Functions

This section is empty.

Types

type ControlFrame

type ControlFrame struct {
	ControlType  uint32
	ContentTypes [][]byte
}

func (*ControlFrame) Decode

func (c *ControlFrame) Decode(r io.Reader) (err error)

func (*ControlFrame) DecodeEscape

func (c *ControlFrame) DecodeEscape(r io.Reader) error

func (*ControlFrame) DecodeTypeEscape

func (c *ControlFrame) DecodeTypeEscape(r io.Reader, ctype uint32) error

func (*ControlFrame) Encode

func (c *ControlFrame) Encode(w io.Writer) (err error)

func (*ControlFrame) EncodeFlush

func (c *ControlFrame) EncodeFlush(w *bufio.Writer) error

func (*ControlFrame) MatchContentType

func (c *ControlFrame) MatchContentType(ctype []byte) bool

func (*ControlFrame) SetContentType

func (c *ControlFrame) SetContentType(ctype []byte)

type Decoder

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

func NewDecoder

func NewDecoder(r io.Reader, opt *DecoderOptions) (dec *Decoder, err error)

func (*Decoder) Decode

func (dec *Decoder) Decode() (frameData []byte, err error)

type DecoderOptions

type DecoderOptions struct {
	MaxPayloadSize uint32
	ContentType    []byte
	Bidirectional  bool
	Timeout        time.Duration
}

type Encoder

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

func NewEncoder

func NewEncoder(w io.Writer, opt *EncoderOptions) (enc *Encoder, err error)

func (*Encoder) Close

func (enc *Encoder) Close() (err error)

func (*Encoder) Flush

func (enc *Encoder) Flush() error

func (*Encoder) Write

func (enc *Encoder) Write(frame []byte) (n int, err error)

type EncoderOptions

type EncoderOptions struct {
	ContentType   []byte
	Bidirectional bool
	Timeout       time.Duration
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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