Documentation ¶
Index ¶
- Variables
- func Ack(writer io.Writer) error
- func CopyFromLocal(ctx context.Context, s *ssh.Session, localPath string, remotePath string) error
- func CopyFromRemote(ctx context.Context, s *ssh.Session, remotePath string, localPath string) error
- func CopyN(writer io.Writer, src io.Reader, size int64) (int64, error)
- func LoadConfig() error
- func LoadConfigBytes(names ...string) ([]byte, error)
- func LoadSshConfig() error
- func ParseHostFile(s string) (host string, filePath string, err error)
- func RecordHistory(cmd string) error
- func SetLogger(logger Logger)
- type CallbackShell
- type Client
- type FileInfos
- type Logger
- type Node
- type Response
- type ResponseType
- type ScpOption
Constants ¶
This section is empty.
Variables ¶
var (
DefaultCiphers = []string{
"aes128-ctr",
"aes192-ctr",
"aes256-ctr",
"aes128-gcm@openssh.com",
"chacha20-poly1305@openssh.com",
"arcfour256",
"arcfour128",
"arcfour",
"aes128-cbc",
"3des-cbc",
"blowfish-cbc",
"cast128-cbc",
"aes192-cbc",
"aes256-cbc",
}
)
Functions ¶
func Ack ¶
Ack writes an `Ack` message to the remote, does not await its response, a seperate call to ParseResponse is therefore required to check if the acknowledgement succeeded.
func CopyFromLocal ¶
func CopyFromRemote ¶
func LoadConfig ¶
func LoadConfig() error
func LoadConfigBytes ¶
func LoadSshConfig ¶
func LoadSshConfig() error
func RecordHistory ¶
Types ¶
type CallbackShell ¶
type Logger ¶
type Node ¶
type Node struct { Name string `yaml:"name"` Alias string `yaml:"alias"` Host string `yaml:"host"` User string `yaml:"user"` Port int `yaml:"port"` KeyPath string `yaml:"keypath"` Passphrase string `yaml:"passphrase"` Password string `yaml:"password"` CallbackShells []*CallbackShell `yaml:"callback-shells"` Children []*Node `yaml:"children"` Jump []*Node `yaml:"jump"` }
type Response ¶
type Response struct { Type ResponseType Message string }
Response represent a response from the SCP command. There are tree types of responses that the remote can send back: ok, warning and error
The difference between warning and error is that the connection is not closed by the remote, however, a warning can indicate a file transfer failure (such as invalid destination directory) and such be handled as such.
All responses except for the `Ok` type always have a message (although these can be empty)
The remote sends a confirmation after every SCP command, because a failure can occur after every command, the response should be read and checked after sending them.
func ParseResponse ¶
ParseResponse reads from the given reader (assuming it is the output of the remote) and parses it into a Response structure.
func (*Response) GetMessage ¶
GetMessage returns the message the remote sent back.
func (*Response) IsFailure ¶
IsFailure returns true when the remote answered with a warning or an error.
func (*Response) ParseFileInfos ¶
type ResponseType ¶
type ResponseType = uint8
const ( Ok ResponseType = 0 Warning ResponseType = 1 Error ResponseType = 2 )