aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport/ssh/common.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-04-26 14:27:39 +0200
committerGitHub <noreply@github.com>2017-04-26 14:27:39 +0200
commitfd361169707a184f6c94f9e4a87c4e656f41f270 (patch)
treef5130ecbf074ad7af2b8c5847bdd0c4d64c35174 /plumbing/transport/ssh/common.go
parent9e4f992d9633dd1ac8cc0b5bcd92b377190a9a03 (diff)
parent63bbba6804c1ee5f52897aaedb8e58574b056bb9 (diff)
downloadgo-git-fd361169707a184f6c94f9e4a87c4e656f41f270.tar.gz
Merge pull request #356 from mcuadros/ssh-default-auth
transport: ssh, new DefaultAuthBuilder variable
Diffstat (limited to 'plumbing/transport/ssh/common.go')
-rw-r--r--plumbing/transport/ssh/common.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/plumbing/transport/ssh/common.go b/plumbing/transport/ssh/common.go
index 9b484f9..7b44a91 100644
--- a/plumbing/transport/ssh/common.go
+++ b/plumbing/transport/ssh/common.go
@@ -14,6 +14,12 @@ import (
// DefaultClient is the default SSH client.
var DefaultClient = common.NewClient(&runner{})
+// DefaultAuthBuilder is the function used to create a default AuthMethod, when
+// the user doesn't provide any.
+var DefaultAuthBuilder = func(user string) (AuthMethod, error) {
+ return NewSSHAgentAuth(user)
+}
+
type runner struct{}
func (r *runner) Command(cmd string, ep transport.Endpoint, auth transport.AuthMethod) (common.Command, error) {
@@ -119,7 +125,7 @@ func (c *command) setAuthFromEndpoint() error {
}
var err error
- c.auth, err = NewSSHAgentAuth(u)
+ c.auth, err = DefaultAuthBuilder(u)
return err
}