forked from bramvdbogaerde/go-scp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scp.go
33 lines (26 loc) · 1.07 KB
/
scp.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* Copyright (c) 2020 Bram Vandenbogaerde
* You may use, distribute or modify this code under the
* terms of the Mozilla Public License 2.0, which is distributed
* along with the source code.
*/
// Simple scp package to copy files over SSH
package scp
import (
"time"
"golang.org/x/crypto/ssh"
)
// Returns a new scp.Client with provided host and ssh.clientConfig
// It has a default timeout of one minute.
func NewClient(host string, config *ssh.ClientConfig) Client {
return NewConfigurer(host, config).Create()
}
// Returns a new scp.Client with provides host, ssh.ClientConfig and timeout
func NewClientWithTimeout(host string, config *ssh.ClientConfig, timeout time.Duration) Client {
return NewConfigurer(host, config).Timeout(timeout).Create()
}
func NewClientWithSudoPassword(host string, config *ssh.ClientConfig, password string) Client {
return NewConfigurer(host, config).SudoPassword(password).Create()
}
func NewClientWithSudoNoPassword(host string, config *ssh.ClientConfig, password string) Client {
return NewConfigurer(host, config).SudoNoPassword().Create()
}