Documentation ¶
Overview ¶
Package ssh implements a ssh client for go-git.
The Connect() method is not allowed in ssh, use ConnectWithAuth() instead.
Index ¶
- Constants
- Variables
- type AuthMethod
- type GitUploadPackService
- func (s *GitUploadPackService) Connect(ep common.Endpoint) (err error)
- func (s *GitUploadPackService) ConnectWithAuth(ep common.Endpoint, auth common.AuthMethod) (err error)
- func (s *GitUploadPackService) Disconnect() (err error)
- func (s *GitUploadPackService) Fetch(r *common.GitUploadPackRequest) (rc io.ReadCloser, err error)
- func (s *GitUploadPackService) Info() (i *common.GitUploadPackInfo, err error)
- type KeyboardInteractive
- type Password
- type PasswordCallback
- type PublicKeys
- type PublicKeysCallback
Constants ¶
const ( KeyboardInteractiveName = "ssh-keyboard-interactive" PasswordName = "ssh-password" PasswordCallbackName = "ssh-password-callback" PublicKeysName = "ssh-public-keys" PublicKeysCallbackName = "ssh-public-key-callback" )
The names of the AuthMethod implementations. To be returned by the Name() method. Most git servers only allow PublicKeysName and PublicKeysCallbackName.
Variables ¶
var ( ErrInvalidAuthMethod = errors.New("invalid ssh auth method") ErrAuthRequired = errors.New("cannot connect: auth required") ErrNotConnected = errors.New("not connected") ErrAlreadyConnected = errors.New("already connected") ErrUploadPackAnswerFormat = errors.New("git-upload-pack bad answer format") ErrUnsupportedVCS = errors.New("only git is supported") ErrUnsupportedRepo = errors.New("only github.com is supported") )
New errors introduced by this package.
Functions ¶
This section is empty.
Types ¶
type AuthMethod ¶
type AuthMethod interface { common.AuthMethod // contains filtered or unexported methods }
AuthMethod is the interface all auth methods for the ssh client must implement. The clientConfig method returns the ssh client configuration needed to establish an ssh connection.
type GitUploadPackService ¶
type GitUploadPackService struct {
// contains filtered or unexported fields
}
GitUploadPackService holds the service information. The zero value is safe to use. TODO: remove NewGitUploadPackService().
func NewGitUploadPackService ¶
func NewGitUploadPackService() *GitUploadPackService
NewGitUploadPackService initialises a GitUploadPackService. TODO: remove this, as the struct is zero-value safe.
func (*GitUploadPackService) Connect ¶
func (s *GitUploadPackService) Connect(ep common.Endpoint) (err error)
Connect cannot be used with SSH clients and always return ErrAuthRequired. Use ConnectWithAuth instead.
func (*GitUploadPackService) ConnectWithAuth ¶
func (s *GitUploadPackService) ConnectWithAuth(ep common.Endpoint, auth common.AuthMethod) (err error)
ConnectWithAuth connects to ep using SSH. Authentication is handled by auth.
func (*GitUploadPackService) Disconnect ¶
func (s *GitUploadPackService) Disconnect() (err error)
Disconnect the SSH client.
func (*GitUploadPackService) Fetch ¶
func (s *GitUploadPackService) Fetch(r *common.GitUploadPackRequest) (rc io.ReadCloser, err error)
Fetch retrieves the GitUploadPack form the repository. You must be connected to the repository before using this method (using the ConnectWithAuth() method). TODO: fetch should really reuse the info session instead of openning a new one
func (*GitUploadPackService) Info ¶
func (s *GitUploadPackService) Info() (i *common.GitUploadPackInfo, err error)
Info returns the GitUploadPackInfo of the repository. The client must be connected with the repository (using the ConnectWithAuth() method) before using this method.
type KeyboardInteractive ¶
type KeyboardInteractive struct { User string Challenge ssh.KeyboardInteractiveChallenge }
KeyboardInteractive implements AuthMethod by using a prompt/response sequence controlled by the server.
func (*KeyboardInteractive) Name ¶
func (a *KeyboardInteractive) Name() string
func (*KeyboardInteractive) String ¶
func (a *KeyboardInteractive) String() string
type PasswordCallback ¶
PasswordCallback implements AuthMethod by using a callback to fetch the password.
func (*PasswordCallback) Name ¶
func (a *PasswordCallback) Name() string
func (*PasswordCallback) String ¶
func (a *PasswordCallback) String() string
type PublicKeys ¶
PublicKeys implements AuthMethod by using the given key pairs.
func (*PublicKeys) Name ¶
func (a *PublicKeys) Name() string
func (*PublicKeys) String ¶
func (a *PublicKeys) String() string
type PublicKeysCallback ¶
PublicKeysCallback implements AuthMethod by asking a ssh.agent.Agent to act as a signer.
func (*PublicKeysCallback) Name ¶
func (a *PublicKeysCallback) Name() string
func (*PublicKeysCallback) String ¶
func (a *PublicKeysCallback) String() string