virtwriter

package
v1.7.0-tar Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClientHangup = errors.New("client hangup")

ClientHangup signifies that the client wants to drop its connection from the server

Functions

func HangUp

func HangUp(writer *bufio.Writer, ec uint32) (err error)

HangUp sends message to peer to close connection

func Reader

func Reader(r *bufio.Reader, output, errput, input io.Writer, resize chan remotecommand.TerminalSize, execEcChan chan int) 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
	// Quit from the client
	HangUpFromClient 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