localhost

package
v2.0.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package localhost provides a rig protocol implementation to the local host using the os/exec package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct{}

Connection is a direct localhost connection.

func NewConnection

func NewConnection() (*Connection, error)

NewConnection creates a new Localhost connection. Error is currently always nil.

func (*Connection) Connection

func (c *Connection) Connection() (protocol.Connection, error)

Connection returns the connection itself. This is because there's no config for localhost connections.

func (*Connection) ExecInteractive

func (c *Connection) ExecInteractive(cmd string, stdin io.Reader, stdout, stderr io.Writer) error

ExecInteractive executes a command on the host and passes stdin/stdout/stderr as-is to the session.

func (*Connection) IPAddress

func (c *Connection) IPAddress() string

IPAddress returns the connection address.

func (*Connection) IsWindows

func (c *Connection) IsWindows() bool

IsWindows is true when running on a windows host.

func (*Connection) Protocol

func (c *Connection) Protocol() string

Protocol returns the protocol name, "Local".

func (*Connection) StartProcess

func (c *Connection) StartProcess(ctx context.Context, cmd string, stdin io.Reader, stdout, stderr io.Writer) (protocol.Waiter, error)

StartProcess executes a command on the remote host and uses the passed in streams for stdin, stdout and stderr. It returns a Waiter with a .Wait() function that blocks until the command finishes and returns an error if the exit code is not zero.

func (*Connection) String

func (c *Connection) String() string

String returns the connection's printable name.

Jump to

Keyboard shortcuts

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