ssh_helper

package module
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 9 Imported by: 1

README

GitHub Workflow Status (with event) GitHub tag (with filter) Go Reference

go-ssh-helper

Usage

SSHClientFactory
package main

import (
    "fmt"

    ssh_helper "github.com/ngyewch/go-ssh-helper"
)

func main() {
    sshClientFactory := ssh_helper.DefaultSSHClientFactory()
    sshClient, err := sshClientFactory.CreateForAlias("myhost")
    if err != nil {
        panic(err)
    }
    // ...
}

Supported ssh_config keywords

Keyword Supported
Host Yes
Match No
AddKeysToAgent No
AddressFamily Yes
BatchMode
BindAddress
BindInterface
CanonicalDomains
CanonicalizeFallbackLocal
CanonicalizeHostname
CanonicalizeMaxDots
CanonicalizePermittedCNAMEs
CASignatureAlgorithms
CertificateFile
CheckHostIP
Ciphers
ClearAllForwardings
Compression
ConnectionAttempts
ConnectTimeout Yes
ControlMaster
ControlPath
ControlPersist
DynamicForward
EnableEscapeCommandline
EnableSSHKeysign
EscapeChar
ExitOnForwardFailure
FingerprintHash
ForkAfterAuthentication
ForwardAgent
ForwardX11
ForwardX11Timeout
ForwardX11Trusted
GatewayPorts
GlobalKnownHostsFile
GSSAPIAuthentication
GSSAPIDelegateCredentials
HashKnownHosts
HostbasedAcceptedAlgorithms
HostbasedAuthentication
HostKeyAlgorithms
HostKeyAlias
Hostname Yes
IdentitiesOnly
IdentityAgent
IdentityFile Yes
IgnoreUnknown
Include Yes
IPQoS
KbdInteractiveAuthentication
KbdInteractiveDevices
KexAlgorithms
KnownHostsCommand
LocalCommand
LocalForward
LogLevel No
LogVerbose No
MACs
NoHostAuthenticationForLocalhost
NumberOfPasswordPrompts
PasswordAuthentication
PermitLocalCommand
PermitRemoteOpen
PKCS11Provider No
Port Yes
PreferredAuthentications
ProxyCommand
ProxyJump Yes
ProxyUseFdpass
PubkeyAcceptedAlgorithms
PubkeyAuthentication
RekeyLimit
RemoteCommand
RemoteForward
RequestTTY
RequiredRSASize
RevokedHostKeys
SecurityKeyProvider No
SendEnv
ServerAliveCountMax
ServerAliveInterval
SessionType
SetEnv
StdinNull
StreamLocalBindMask
StreamLocalBindUnlink
StrictHostKeyChecking
SyslogFacility
TCPKeepAlive
Tag
Tunnel
TunnelDevice
UpdateHostKeys
User Yes
UserKnownHostsFile
VerifyHostKeyDNS
VisualHostKey
XAuthLocation

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadSignerFromFile

func LoadSignerFromFile(path string) (ssh.Signer, error)

LoadSignerFromFile instantiates an ssh.Signer from a file containing a private key.

Types

type SSHClientFactory

type SSHClientFactory struct {
	// contains filtered or unexported fields
}

SSHClientFactory is a factory for creating ssh.Client.

func DefaultSSHClientFactory

func DefaultSSHClientFactory() *SSHClientFactory

DefaultSSHClientFactory returns the default SSHClientFactory

func NewSSHClientFactory

func NewSSHClientFactory(userSettings *ssh_config.UserSettings) *SSHClientFactory

NewSSHClientFactory instantiates a new SSHClientFactory.

func (*SSHClientFactory) CreateForAlias

func (factory *SSHClientFactory) CreateForAlias(alias string) (*ssh.Client, error)

CreateForAlias creates a new ssh.Client for the specified alias.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL