streams

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: GPL-3.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFilterWriter

func NewFilterWriter(
	filter *Filter,
	outputBuffer io.Writer,
) io.WriteCloser

Types

type EndSessionHandler

type EndSessionHandler func()

Call back to close sessions and streams being intercepted

type Expect

type Expect struct {
	// start of match
	StartPattern,

	EndPattern string

	// command to send on match
	Command string

	// match only once line is complete
	OnNewLine bool
	// exit after sending command if matched
	Exit bool
	// contains filtered or unexported fields
}

type ExpectStream

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

func NewExpectStream

func NewExpectStream(
	inputStream io.Reader,
	outputStream io.Writer,
	endSession EndSessionHandler,
) (
	*ExpectStream,
	io.ReadCloser,
	io.WriteCloser,
)

the expect stream will search for expect patterns in the input stream and respond with commands in the output stream with a response associated with that pattern. patterns and their commands are evaluated in order.

func (*ExpectStream) AddExpectInTrigger

func (es *ExpectStream) AddExpectInTrigger(
	expect *Expect,
)

func (*ExpectStream) AddExpectOutTrigger

func (es *ExpectStream) AddExpectOutTrigger(
	expect *Expect,
	serial bool,
)

func (*ExpectStream) Close

func (es *ExpectStream) Close()

func (*ExpectStream) SetBufferSize

func (es *ExpectStream) SetBufferSize(size int)

func (*ExpectStream) SetShellExitCommand

func (es *ExpectStream) SetShellExitCommand(command string)

func (*ExpectStream) Start

func (es *ExpectStream) Start()

func (*ExpectStream) StartAsShell

func (es *ExpectStream) StartAsShell()

type Filter

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

Filter

func (*Filter) AddExcludeAfterPattern

func (f *Filter) AddExcludeAfterPattern(pattern string)

func (*Filter) AddExcludePattern

func (f *Filter) AddExcludePattern(pattern string)

func (*Filter) AddIncludeAfterPattern

func (f *Filter) AddIncludeAfterPattern(pattern string)

func (*Filter) AddIncludePattern

func (f *Filter) AddIncludePattern(pattern string)

func (*Filter) ClearPatterns

func (f *Filter) ClearPatterns()

func (*Filter) SetBlackHole

func (f *Filter) SetBlackHole()

func (*Filter) SetPassThru

func (f *Filter) SetPassThru()

type WriteAtBuffer

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

A buffer that implements the io.WriteAt interface and writing data to a internal buffer which get's written to the output when a contiguous set of bytes become available.

func NewWriteAtBuffer

func NewWriteAtBuffer(data io.Writer) *WriteAtBuffer

func (*WriteAtBuffer) Close

func (w *WriteAtBuffer) Close() error

func (*WriteAtBuffer) WriteAt

func (w *WriteAtBuffer) WriteAt(b []byte, offset int64) (int, error)

Jump to

Keyboard shortcuts

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