Documentation ¶
Overview ¶
Copyright 2021 yubo. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Copyright 2021 yubo. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
from github.com/yubo/gotty/rec
Copyright 2021 yubo. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Copyright 2021 yubo. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Copyright 2021 yubo. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Copyright 2021 yubo. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Copyright 2021 yubo. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Copyright 2021 yubo. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Copyright 2021 yubo. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Index ¶
- Constants
- Variables
- func CopyPtyStreams(tty TtyStreams, pty PtyStreams) chan error
- func CopyToPty(tty Tty, pty Pty) <-chan error
- func EnvsToKv(envs []string) map[string]string
- func Nanotime() int64
- func NewEscapeProxy(reader io.Reader, keys []byte) io.Reader
- type CloseFunc
- type CmdPty
- type CtlMsg
- type Exec
- type NativeTty
- func (p *NativeTty) Close() error
- func (p *NativeTty) CopyToPty(pty Pty) <-chan error
- func (p *NativeTty) Done() <-chan struct{}
- func (p *NativeTty) Err() error
- func (p *NativeTty) GetSize() *term.TerminalSize
- func (p *NativeTty) IsTerminal() bool
- func (p *NativeTty) MonitorSize(size ...*term.TerminalSize) term.TerminalSizeQueue
- func (p *NativeTty) Safe(fn term.SafeFunc) error
- func (p *NativeTty) SetupTTY() *term.TTY
- func (p *NativeTty) Streams() TtyStreams
- type Opt
- type Options
- type Player
- type PlayerStreams
- type ProxyTty
- func (p *ProxyTty) AddRecorder(r Recorder) error
- func (p *ProxyTty) AddTty(tty Tty, opts ...Opt) error
- func (p *ProxyTty) Close() error
- func (p *ProxyTty) CopyToPty(pty Pty) <-chan error
- func (p *ProxyTty) Done() <-chan struct{}
- func (p *ProxyTty) Err() error
- func (t *ProxyTty) GetSize() *term.TerminalSize
- func (p *ProxyTty) IsTerminal() bool
- func (p *ProxyTty) MonitorSize(initialSizes ...*term.TerminalSize) term.TerminalSizeQueue
- func (p *ProxyTty) Next() *term.TerminalSize
- func (p *ProxyTty) Streams() TtyStreams
- type Pty
- type PtyStreams
- type ReadFunc
- type RecData
- type Recorder
- type RecorderFactory
- type RecorderStreams
- type StreamTty
- func (p *StreamTty) Close() error
- func (p *StreamTty) CopyToPty(pty Pty) <-chan error
- func (p *StreamTty) Done() <-chan struct{}
- func (p *StreamTty) Err() error
- func (p *StreamTty) GetSize() *term.TerminalSize
- func (p *StreamTty) IsTerminal() bool
- func (p *StreamTty) MonitorSize(initialSizes ...*term.TerminalSize) term.TerminalSizeQueue
- func (p *StreamTty) Next() *term.TerminalSize
- func (p *StreamTty) Streams() TtyStreams
- type Tty
- type TtyStreams
- type WriteFunc
Constants ¶
const ( MsgInput byte = '0' + iota // User input typically from a keyboard MsgOutput // Normal output to the terminal MsgErrOutput // Normal output to the terminal MsgResize // Notify that the browser size has been changed MsgPing MsgCtl MsgInfo MsgAction // custom Action )
const (
SampleTime = time.Second / 100 // 100Hz
)
Variables ¶
var (
MagicCode = []byte{0xff, 0xf1, 0xf2, 0xf3}
)
Functions ¶
func CopyPtyStreams ¶
func CopyPtyStreams(tty TtyStreams, pty PtyStreams) chan error
Types ¶
type CmdPty ¶
type CmdPty struct {
// contains filtered or unexported fields
}
func (*CmdPty) IsTerminal ¶
func (*CmdPty) Streams ¶
func (p *CmdPty) Streams() PtyStreams
type Exec ¶
type Exec struct {
// contains filtered or unexported fields
}
func (*Exec) IsTerminal ¶
func (*Exec) PtyStreams ¶
func (p *Exec) PtyStreams() PtyStreams
type NativeTty ¶
func (*NativeTty) GetSize ¶
func (p *NativeTty) GetSize() *term.TerminalSize
func (*NativeTty) IsTerminal ¶
func (*NativeTty) MonitorSize ¶
func (p *NativeTty) MonitorSize(size ...*term.TerminalSize) term.TerminalSizeQueue
func (*NativeTty) Streams ¶
func (p *NativeTty) Streams() TtyStreams
type Player ¶
type Player struct {
// contains filtered or unexported fields
}
func (*Player) Streams ¶
func (p *Player) Streams() PtyStreams
type PlayerStreams ¶
type ProxyTty ¶
func (*ProxyTty) AddRecorder ¶
func (*ProxyTty) GetSize ¶
func (t *ProxyTty) GetSize() *term.TerminalSize
func (*ProxyTty) IsTerminal ¶
func (*ProxyTty) MonitorSize ¶
func (p *ProxyTty) MonitorSize(initialSizes ...*term.TerminalSize) term.TerminalSizeQueue
func (*ProxyTty) Next ¶
func (p *ProxyTty) Next() *term.TerminalSize
func (*ProxyTty) Streams ¶
func (p *ProxyTty) Streams() TtyStreams
type Pty ¶
type Pty interface { Streams() PtyStreams IsTerminal() bool Resize(*term.TerminalSize) error Close() error }
type PtyStreams ¶
type Recorder ¶
type Recorder interface { Close() error Streams() RecorderStreams Resize(size *term.TerminalSize) error Info(info []byte) error }
func NewRecorder ¶
func NewRecorder(out io.WriteCloser) (Recorder, error)
type RecorderFactory ¶
type RecorderFactory func(out io.WriteCloser) (Recorder, error)
type RecorderStreams ¶
type StreamTty ¶
func NewStreamTty ¶
func NewStreamTty(ctx context.Context, in io.Reader, out, errOut io.WriteCloser, isTty bool, resize <-chan term.TerminalSize) *StreamTty
func (*StreamTty) GetSize ¶
func (p *StreamTty) GetSize() *term.TerminalSize
func (*StreamTty) IsTerminal ¶
func (*StreamTty) MonitorSize ¶
func (p *StreamTty) MonitorSize(initialSizes ...*term.TerminalSize) term.TerminalSizeQueue
func (*StreamTty) Next ¶
func (p *StreamTty) Next() *term.TerminalSize
func (*StreamTty) Streams ¶
func (p *StreamTty) Streams() TtyStreams
type Tty ¶
type Tty interface { Streams() TtyStreams IsTerminal() bool GetSize() *term.TerminalSize MonitorSize(...*term.TerminalSize) term.TerminalSizeQueue CopyToPty(pty Pty) <-chan error Done() <-chan struct{} Err() error Close() error }
type TtyStreams ¶
type TtyStreams struct { Stdin io.Reader // os.Stdin Stdout io.Writer // os.Stdout Stderr io.Writer // os.Stderr }
TtyStreams provides the standard names for iostreams. This is useful for embedding and for unit testing. Inconsistent and different names make it hard to read and review code