sshremote

package
v0.0.0-...-03333d7 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthPublicKey

func AuthPublicKey(in io.Reader) ssh.AuthMethod

AuthPublicKey attempts to read a public keys, returns nil on failure

func AuthPublicKeyFile

func AuthPublicKeyFile(path string) ssh.AuthMethod

AuthPublicKeyFile attempts to read a public key from a file, returns nil on failure

func Dial

func Dial(addr, user, prefix string, auths []ssh.AuthMethod) (*sftp.Client, error)

Dial opens a new ssh connection with path relative to 'prefix' This is for convenience and simplicity, and does not necessarily protect against abuse on the remote system!

func New

func New(client *sftp.Client, path string, transform func(string) []string) kvs.Store

New returns a new Cache given an opened *sftp.Client

Types

type SSHStore

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

SSHStore implements a KVS over ssh

func (*SSHStore) Close

func (s *SSHStore) Close()

Close closes the client

func (*SSHStore) Exists

func (s *SSHStore) Exists(key string) (bool, error)

Exists checks if a file exists on the server

func (*SSHStore) Read

func (s *SSHStore) Read(key string) ([]byte, error)

Read returns a []byte read from a filesystem cache err is same as Read

func (*SSHStore) ReadStream

func (s *SSHStore) ReadStream(key string) (io.ReadCloser, error)

ReadStream returns an io.ReadCloser to read content from the cache. err == nil only when a valid ReadCloser is returned.

func (*SSHStore) Remove

func (s *SSHStore) Remove(key string) error

Remove deletes a key from the Store. returns kvs.ErrNotFound when key is not found.

func (*SSHStore) Write

func (s *SSHStore) Write(key string, data []byte) error

Write writes data to key, returning kvs.ErrExists if key already exists

func (*SSHStore) WriteStream

func (s *SSHStore) WriteStream(key string, reader io.Reader) error

WriteStream writes the contents of the Reader to a new file. kvs.ErrExists returned if file exists

Jump to

Keyboard shortcuts

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