mirror of
https://github.com/appleboy/drone-ssh.git
synced 2025-05-09 18:23:21 +08:00
[easyssh] make connect method as public. (appleboy/easyssh-proxy#36)
* make connect method as public. Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * fix go path. Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * fix golint error. Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> https://github.com/appleboy/drone-ssh/commit/ca8e8301291
This commit is contained in:
parent
71cbc0efd3
commit
cfa11e851a
18
vendor/github.com/appleboy/easyssh-proxy/easyssh.go
generated
vendored
18
vendor/github.com/appleboy/easyssh-proxy/easyssh.go
generated
vendored
@ -104,8 +104,8 @@ func getSSHConfig(config DefaultConfig) *ssh.ClientConfig {
|
||||
}
|
||||
}
|
||||
|
||||
// connect to remote server using MakeConfig struct and returns *ssh.Session
|
||||
func (ssh_conf *MakeConfig) connect() (*ssh.Session, error) {
|
||||
// Connect to remote server using MakeConfig struct and returns *ssh.Session
|
||||
func (ssh_conf *MakeConfig) Connect() (*ssh.Session, error) {
|
||||
var client *ssh.Client
|
||||
var err error
|
||||
|
||||
@ -168,13 +168,13 @@ func (ssh_conf *MakeConfig) Stream(command string, timeout int) (<-chan string,
|
||||
doneChan := make(chan bool)
|
||||
errChan := make(chan error)
|
||||
|
||||
// connect to remote host
|
||||
session, err := ssh_conf.connect()
|
||||
// Connect to remote host
|
||||
session, err := ssh_conf.Connect()
|
||||
if err != nil {
|
||||
return stdoutChan, stderrChan, doneChan, errChan, err
|
||||
}
|
||||
// defer session.Close()
|
||||
// connect to both outputs (they are of type io.Reader)
|
||||
// Connect to both outputs (they are of type io.Reader)
|
||||
outReader, err := session.StdoutPipe()
|
||||
if err != nil {
|
||||
return stdoutChan, stderrChan, doneChan, errChan, err
|
||||
@ -258,7 +258,7 @@ loop:
|
||||
|
||||
// Scp uploads sourceFile to remote machine like native scp console app.
|
||||
func (ssh_conf *MakeConfig) Scp(sourceFile string, etargetFile string) error {
|
||||
session, err := ssh_conf.connect()
|
||||
session, err := ssh_conf.Connect()
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
@ -297,9 +297,5 @@ func (ssh_conf *MakeConfig) Scp(sourceFile string, etargetFile string) error {
|
||||
}
|
||||
}()
|
||||
|
||||
if err := session.Run(fmt.Sprintf("scp -tr %s", etargetFile)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return session.Run(fmt.Sprintf("scp -tr %s", etargetFile))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user