diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-13 20:07:21 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-13 20:07:21 +0200 |
commit | a65bcbc63bef24cf219c63d1b8cfb309c95d1c0f (patch) | |
tree | 973644feaf08adc916dab8fb95d1f6c86194c9c1 /clients/ssh/git_upload_pack.go | |
parent | a6ea9e8dd2eda48c8405f609e0fb444d3717af53 (diff) | |
download | go-git-a65bcbc63bef24cf219c63d1b8cfb309c95d1c0f.tar.gz |
clients: new Endpoint implementation and InstallProtocol function
Diffstat (limited to 'clients/ssh/git_upload_pack.go')
-rw-r--r-- | clients/ssh/git_upload_pack.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/clients/ssh/git_upload_pack.go b/clients/ssh/git_upload_pack.go index be5f7d0..551ab9c 100644 --- a/clients/ssh/git_upload_pack.go +++ b/clients/ssh/git_upload_pack.go @@ -15,8 +15,8 @@ import ( "gopkg.in/src-d/go-git.v4/clients/common" "gopkg.in/src-d/go-git.v4/formats/pktline" - "gopkg.in/sourcegraph/go-vcsurl.v1" "golang.org/x/crypto/ssh" + "gopkg.in/sourcegraph/go-vcsurl.v1" ) // New errors introduced by this package. @@ -35,6 +35,7 @@ var ( // TODO: remove NewGitUploadPackService(). type GitUploadPackService struct { connected bool + endpoint common.Endpoint vcs *vcsurl.RepoInfo client *ssh.Client auth AuthMethod @@ -42,24 +43,24 @@ type GitUploadPackService struct { // NewGitUploadPackService initialises a GitUploadPackService. // TODO: remove this, as the struct is zero-value safe. -func NewGitUploadPackService() *GitUploadPackService { - return &GitUploadPackService{} +func NewGitUploadPackService(endpoint common.Endpoint) common.GitUploadPackService { + return &GitUploadPackService{endpoint: endpoint} } // Connect cannot be used with SSH clients and always return // ErrAuthRequired. Use ConnectWithAuth instead. -func (s *GitUploadPackService) Connect(ep common.Endpoint) (err error) { +func (s *GitUploadPackService) Connect() (err error) { return ErrAuthRequired } // ConnectWithAuth connects to ep using SSH. Authentication is handled // by auth. -func (s *GitUploadPackService) ConnectWithAuth(ep common.Endpoint, auth common.AuthMethod) (err error) { +func (s *GitUploadPackService) ConnectWithAuth(auth common.AuthMethod) (err error) { if s.connected { return ErrAlreadyConnected } - s.vcs, err = vcsurl.Parse(string(ep)) + s.vcs, err = vcsurl.Parse(s.endpoint.String()) if err != nil { return err } |