tube

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(t interface{}) []byte

Bytes takes type interface{} and converts it to []byte, if it can't convert to []byte it will panic.

Types

type Listener

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

func NewListener

func NewListener(addr string) (*Listener, error)

func (*Listener) Close

func (l *Listener) Close() error

func (*Listener) Interactive

func (t *Listener) Interactive() error

Interactive allows the user to interact with the tube manually.

func (*Listener) NewLine

func (t *Listener) NewLine() byte

func (*Listener) RecvLine

func (t *Listener) RecvLine() ([]byte, error)

RecvLine receives data until a newline delimiter is detected.

func (*Listener) RecvN

func (t *Listener) RecvN(n int) ([]byte, error)

RecvN receives a specified number of bytes

func (*Listener) RecvUntil

func (t *Listener) RecvUntil(needle []byte, drop bool) ([]byte, error)

RecvUntil receives data until the specified sequence of bytes is detected.

func (*Listener) RecvUntilWithContext

func (t *Listener) RecvUntilWithContext(ctx context.Context, needle []byte, drop bool) ([]byte, error)

RecvUntilWithContext receives data until the specified sequence of bytes is detected or the context is done.

func (*Listener) SendLine

func (t *Listener) SendLine(input interface{}) (int, error)

SendLine sends data with a trailing newline character

func (*Listener) WaitForConnection

func (l *Listener) WaitForConnection() error

type Process

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

func NewProcess

func NewProcess(argv []string, optFns ...func(o *ProcessOptions)) (*Process, error)

func (*Process) CWD

func (p *Process) CWD() (string, error)

func (*Process) Interactive

func (t *Process) Interactive() error

Interactive allows the user to interact with the tube manually.

func (*Process) Kill

func (p *Process) Kill() error

Kill causes the Process to exit immediately. Kill does not wait until the Process has actually exited. This only kills the Process itself, not any other processes it may have started.

func (*Process) NewLine

func (t *Process) NewLine() byte

func (*Process) PID

func (p *Process) PID() int

PID returns the pid of the process.

func (*Process) RecvLine

func (t *Process) RecvLine() ([]byte, error)

RecvLine receives data until a newline delimiter is detected.

func (*Process) RecvN

func (t *Process) RecvN(n int) ([]byte, error)

RecvN receives a specified number of bytes

func (*Process) RecvUntil

func (t *Process) RecvUntil(needle []byte, drop bool) ([]byte, error)

RecvUntil receives data until the specified sequence of bytes is detected.

func (*Process) RecvUntilWithContext

func (t *Process) RecvUntilWithContext(ctx context.Context, needle []byte, drop bool) ([]byte, error)

RecvUntilWithContext receives data until the specified sequence of bytes is detected or the context is done.

func (*Process) SendLine

func (t *Process) SendLine(input interface{}) (int, error)

SendLine sends data with a trailing newline character

func (*Process) Signal

func (p *Process) Signal(sig os.Signal) error

Signal sends a signal to the Process. Sending Interrupt on Windows is not implemented.

type ProcessOptions

type ProcessOptions struct {
	Env     []string
	Dir     string
	NewLine byte
}

type Remote

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

func NewRemote

func NewRemote(network, addr string) (*Remote, error)

func (*Remote) Close

func (r *Remote) Close() error

func (*Remote) Interactive

func (t *Remote) Interactive() error

Interactive allows the user to interact with the tube manually.

func (*Remote) NewLine

func (t *Remote) NewLine() byte

func (*Remote) RecvLine

func (t *Remote) RecvLine() ([]byte, error)

RecvLine receives data until a newline delimiter is detected.

func (*Remote) RecvN

func (t *Remote) RecvN(n int) ([]byte, error)

RecvN receives a specified number of bytes

func (*Remote) RecvUntil

func (t *Remote) RecvUntil(needle []byte, drop bool) ([]byte, error)

RecvUntil receives data until the specified sequence of bytes is detected.

func (*Remote) RecvUntilWithContext

func (t *Remote) RecvUntilWithContext(ctx context.Context, needle []byte, drop bool) ([]byte, error)

RecvUntilWithContext receives data until the specified sequence of bytes is detected or the context is done.

func (*Remote) SendLine

func (t *Remote) SendLine(input interface{}) (int, error)

SendLine sends data with a trailing newline character

Jump to

Keyboard shortcuts

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