machine: Index | Files

package ssh

import ""


Package Files

client.go keys.go


var (
    ErrKeyGeneration     = errors.New("Unable to generate key")
    ErrValidation        = errors.New("Unable to validate key")
    ErrPublicKey         = errors.New("Unable to convert public key")
    ErrUnableToWriteFile = errors.New("Unable to write file")

func GenerateSSHKey Uses

func GenerateSSHKey(path string) error

Generate SSH keypair based on path of the private key The public key would be generated to the same path with ".pub" added

func NewNativeConfig Uses

func NewNativeConfig(user string, auth *Auth) (ssh.ClientConfig, error)

func SetDefaultClient Uses

func SetDefaultClient(clientType SSHClientType)

type Auth Uses

type Auth struct {
    Passwords []string
    Keys      []string

type Client Uses

type Client interface {
    Output(command string) (string, error)
    Shell() error

func NewClient Uses

func NewClient(user string, host string, port int, auth *Auth) (Client, error)

func NewNativeClient Uses

func NewNativeClient(user, host string, port int, auth *Auth) (Client, error)

type ExternalClient Uses

type ExternalClient struct {
    BaseArgs   []string
    BinaryPath string

func NewExternalClient Uses

func NewExternalClient(sshBinaryPath, user, host string, port int, auth *Auth) (ExternalClient, error)

func (ExternalClient) Output Uses

func (client ExternalClient) Output(command string) (string, error)

func (ExternalClient) Shell Uses

func (client ExternalClient) Shell() error

type KeyPair Uses

type KeyPair struct {
    PrivateKey []byte
    PublicKey  []byte

func NewKeyPair Uses

func NewKeyPair() (keyPair *KeyPair, err error)

Generate a new SSH keypair This will return a private & public key encoded as DER.

func (*KeyPair) Fingerprint Uses

func (kp *KeyPair) Fingerprint() string

Calculate the fingerprint of the public key

func (*KeyPair) WriteToFile Uses

func (kp *KeyPair) WriteToFile(privateKeyPath string, publicKeyPath string) error

Write keypair to files

type NativeClient Uses

type NativeClient struct {
    Config   ssh.ClientConfig
    Hostname string
    Port     int

func (NativeClient) Output Uses

func (client NativeClient) Output(command string) (string, error)

func (NativeClient) OutputWithPty Uses

func (client NativeClient) OutputWithPty(command string) (string, error)

func (NativeClient) Shell Uses

func (client NativeClient) Shell() error

type SSHClientType Uses

type SSHClientType string
const (
    External SSHClientType = "external"
    Native   SSHClientType = "native"

Package ssh imports 19 packages (graph). Updated 2018-05-20. Refresh now. Tools for package owners.