io

package
v0.0.0-...-09eb250 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ControlChar is the rune used to indicate start of a binary message
	ControlChar = '!'

	// ControlLineLength is the fixed length of the incoming binary message
	ControlLineLength = 4 + 1
)

Variables

This section is empty.

Functions

func LinePipe

func LinePipe(reader io.Reader, writer io.Writer, c Conn) error

LinePipe turns the reader and writer into two channels that use a line based text protocol with a binary control protocol signaled by the ControlChar. Only capable of reading 'response' format control data.

Types

type Any

type Any interface{}

type Conn

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

Conn is a generic bidirectional IO stream. Can be flipped to use a tail Conn as the head Conn for the next handler or vice versa.

func NewConn

func NewConn(rSize, wSize int) Conn

NewConn creates a new Conn with the desired chan buffer size.

func (Conn) Flip

func (c Conn) Flip() Conn

Flip the Conn to convert a tail Conn to a head Conn

func (Conn) Rc

func (c Conn) Rc() <-chan Any

Rc returns the read channel for this Conn

func (Conn) Wc

func (c Conn) Wc() chan<- Any

Wc returns the write channel for this Conn

func (Conn) Write

func (c Conn) Write(msg Any)

Write is a convenience function for c.Wc() <- msg

Jump to

Keyboard shortcuts

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