rio

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

package rio is an abstraction for IO operations that may be performed locally, or remotely via golang.org/x/crypto/ssh.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

type Cmd struct {
	Path string
	Args []string
	Env  [][2]string
	Dir  string

	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer

	Host    string
	Context context.Context
	// contains filtered or unexported fields
}

func (*Cmd) Run

func (cmd *Cmd) Run() error

type Config

type Config struct {
	// Pool is an SSH connection pool. If nil, local mode is used on the current host.
	Pool *sshpool.Pool

	// Host to connect to. Leave blank for local mode.
	Host string

	// User to switch to. If blank, currently running user is used, or default user of SSH
	// connection for remote connections. If specified, sudo will be used to attempt to
	// switch to that user.
	Sudo string

	Verbose bool
}

func (*Config) Command

func (config *Config) Command(ctx context.Context, path string, args ...string) *Cmd

func (*Config) Create

func (config *Config) Create(path string) (io.WriteCloser, error)

func (*Config) Open

func (config *Config) Open(path string) (io.ReadCloser, error)

func (*Config) ReadFile

func (config *Config) ReadFile(path string) ([]byte, error)

func (*Config) Remove

func (config *Config) Remove(path string) error

func (*Config) Stat

func (config *Config) Stat(path string) (os.FileInfo, error)

type FileInfo

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

func (*FileInfo) IsDir

func (fi *FileInfo) IsDir() bool

func (*FileInfo) ModTime

func (fi *FileInfo) ModTime() time.Time

func (*FileInfo) Mode

func (fi *FileInfo) Mode() os.FileMode

func (*FileInfo) Name

func (fi *FileInfo) Name() string

func (*FileInfo) Size

func (fi *FileInfo) Size() int64

func (*FileInfo) String

func (fi *FileInfo) String() string

func (*FileInfo) Sys

func (fi *FileInfo) Sys() interface{}

type SSHReader

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

func (*SSHReader) Close

func (r *SSHReader) Close() error

func (*SSHReader) Read

func (r *SSHReader) Read(p []byte) (int, error)

type SSHWriter

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

func (*SSHWriter) Close

func (w *SSHWriter) Close() error

func (*SSHWriter) Write

func (w *SSHWriter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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