virtwriter

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Reader

func Reader(r *bufio.Reader, output, errput *os.File, input *io.PipeWriter, resize chan remotecommand.TerminalSize) error

Reader decodes the content that comes over the wire and directs it to the proper destination.

Types

type SocketDest

type SocketDest int

SocketDest is the "key" to where IO should go on the varlink multiplexed socket

const (
	// ToStdout indicates traffic should go stdout
	ToStdout SocketDest = iota
	// ToStdin indicates traffic came from stdin
	ToStdin SocketDest = iota
	// ToStderr indicates traffuc should go to stderr
	ToStderr SocketDest = iota
	// TerminalResize indicates a terminal resize event has occurred
	// and data should be passed to resizer
	TerminalResize SocketDest = iota
	// Quit and detach
	Quit SocketDest = iota
)

func IntToSocketDest

func IntToSocketDest(i int) SocketDest

IntToSocketDest returns a socketdest based on integer input

func (SocketDest) Int

func (sd SocketDest) Int() int

Int returns the integer representation of the socket dest

type VirtWriteCloser

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

VirtWriteCloser are writers for attach which include the dest of the data

func NewVirtWriteCloser

func NewVirtWriteCloser(w *bufio.Writer, dest SocketDest) VirtWriteCloser

NewVirtWriteCloser is a constructor

func (VirtWriteCloser) Close

func (v VirtWriteCloser) Close() error

Close is a required method for a writecloser

func (VirtWriteCloser) Write

func (v VirtWriteCloser) Write(input []byte) (int, error)

Write prepends a header to the input message. The header is 8bytes. Position one contains the destination. Positions 5,6,7,8 are a big-endian encoded uint32 for len of the message.

Jump to

Keyboard shortcuts

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