sssh

package module
v0.0.0-...-47b4ad9 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2022 License: MIT Imports: 9 Imported by: 0

README

sssh

a simple wrapper for zero-config ssh and scp/sftp defaults in go

please find the docs here

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(addr string, conf *ssh.ClientConfig) (*ssh.Client, error)

Connect opens a new ssh client.

The difference to ssh.Dial is that every given auth method is tried individually till the connection is up or all have been tried.

func CopyFile

func CopyFile(client *ssh.Client, src, dst string) error

CopyFile copies a file to the target via sftp. Does not check if file is present at dst, will overwrite.

func GetTermdata

func GetTermdata() (int, string, int, int, error)

GetTermdata returns a set of values from the currently used terminal that is required to request a remote pty.

Returns the terminal file descriptor, terminal type (will fall back to xterm if none is found), window width and window height. Will error when no real terminal is attached.

func MakeInteractive

func MakeInteractive(session *ssh.Session) (func(), error)

MakeInteractive requests a PTY to be attached to the calling terminal. The returned function can be used to restore the Terminal to the previous state (alias for term.Restore)

func MoveFile

func MoveFile(client *ssh.Client, src, dst string) error

MoveFile moves a file via sftp.

func PullFile

func PullFile(client *ssh.Client, src, dst string) error

PullFile copies a remote file to a local destination.

func ReadFile

func ReadFile(client *ssh.Client, path string) ([]byte, os.FileInfo, error)

ReadFile reads a remote file.

func RemoveFile

func RemoveFile(client *ssh.Client, path string) error

RemoveFile removes a file or (empty) directory via sftp.

func StartBufferedInteractiveShell

func StartBufferedInteractiveShell(client *ssh.Client, stdout, stderr, stdin io.Writer) error

StartBufferedInteractiveShell starts an interactive shell in its own pty on the given client. Writes the i/o streams to the given writers.

func StartCommand

func StartCommand(client *ssh.Client, command string) ([]byte, error)

StartCommand starts the given command non-interactively on the given ssh session. This is pretty much equal to session.CombinedOutput()

func StartInteractiveBufferedCommand

func StartInteractiveBufferedCommand(client *ssh.Client, command string, stdout, stderr, stdin io.Writer) error

StartInteractiveBufferedCommand starts a command in a pty on the given client. Writes the i/o streams to the given writers.

func StartInteractiveCommand

func StartInteractiveCommand(client *ssh.Client, command string) error

StartInteractiveCommand starts a command in a pty on the given client.

func StartInteractiveShell

func StartInteractiveShell(client *ssh.Client) error

StartInteractiveShell starts an interactive shell in its own pty on the given client.

func WriteFile

func WriteFile(client *ssh.Client, src []byte, dst string, fm os.FileMode) error

WriteFile writes b to the target via sftp. Does not check if file is present at dst, will overwrite.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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