Documentation
¶
Overview ¶
Package localhost provides a rig protocol implementation to the local host using the os/exec package.
Index ¶
- type Connection
- func (c *Connection) Connection() (protocol.Connection, error)
- func (c *Connection) ExecInteractive(cmd string, stdin io.Reader, stdout, stderr io.Writer) error
- func (c *Connection) IPAddress() string
- func (c *Connection) IsWindows() bool
- func (c *Connection) Protocol() string
- func (c *Connection) StartProcess(ctx context.Context, cmd string, stdin io.Reader, stdout, stderr io.Writer) (protocol.Waiter, error)
- func (c *Connection) String() string
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 ¶
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.