streams

package
v0.3.35 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2021 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HijackedIOStreamer

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

HijackedIOStreamer handles copying input to and output from streams to the connection.

func NewHijackedStreamer

func NewHijackedStreamer(inStr *In, outStr *Out, inputStream io.ReadCloser, outputStream io.Writer, errorStream io.Writer, resp types.HijackedResponse, tty bool, detachKeys string, logger hclog.Logger) *HijackedIOStreamer

NewHijackedStreamer creates a new stream for reading and writing TTY terminals

func (*HijackedIOStreamer) Stream

func (h *HijackedIOStreamer) Stream(ctx context.Context) error

Stream handles setting up the IO and then begins streaming stdin/stdout to/from the hijacked connection, blocking until it is either done reading output, the user inputs the detach key sequence when in TTY mode, or when the given context is cancelled.

type In

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

In is an input stream used by the DockerCli to read user input

func NewIn

func NewIn(in io.ReadCloser) *In

NewIn returns a new In object from a ReadCloser

func (*In) CheckTty

func (i *In) CheckTty(attachStdin, ttyMode bool) error

CheckTty checks if we are trying to attach to a container tty from a non-tty client input stream, and if so, returns an error.

func (*In) Close

func (i *In) Close() error

Close implements the Closer interface

func (*In) FD

func (s *In) FD() uintptr

FD returns the file descriptor number for this stream

func (*In) IsTerminal

func (s *In) IsTerminal() bool

IsTerminal returns true if this stream is connected to a terminal

func (*In) Read

func (i *In) Read(p []byte) (int, error)

func (*In) RestoreTerminal

func (s *In) RestoreTerminal()

RestoreTerminal restores normal mode to the terminal

func (*In) SetIsTerminal

func (s *In) SetIsTerminal(isTerminal bool)

SetIsTerminal sets the boolean used for isTerminal

func (*In) SetRawTerminal

func (i *In) SetRawTerminal() (err error)

SetRawTerminal sets raw mode on the input terminal

type Out

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

Out is an output stream used by the DockerCli to write normal program output.

func NewOut

func NewOut(out io.Writer) *Out

NewOut returns a new Out object from a Writer

func (*Out) FD

func (s *Out) FD() uintptr

FD returns the file descriptor number for this stream

func (*Out) GetTtySize

func (o *Out) GetTtySize() (uint, uint)

GetTtySize returns the height and width in characters of the tty

func (*Out) IsTerminal

func (s *Out) IsTerminal() bool

IsTerminal returns true if this stream is connected to a terminal

func (*Out) RestoreTerminal

func (s *Out) RestoreTerminal()

RestoreTerminal restores normal mode to the terminal

func (*Out) SetIsTerminal

func (s *Out) SetIsTerminal(isTerminal bool)

SetIsTerminal sets the boolean used for isTerminal

func (*Out) SetRawTerminal

func (o *Out) SetRawTerminal() (err error)

SetRawTerminal sets raw mode on the input terminal

func (*Out) Write

func (o *Out) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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