ssh

package
v0.0.0-...-d0d3e00 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddIdentityToSSHConfig

func AddIdentityToSSHConfig(identity string, hostname string, f *os.File) error

func AuthMethod

func AuthMethod(identity string, out io.Writer) (gossh.AuthMethod, error)

func ConfigFile

func ConfigFile() (*os.File, error)

func Decrypt

func Decrypt(cypherText string, privateKey *rsa.PrivateKey) (string, error)

func Encrypt

func Encrypt(secret string, publicKey ssh.PublicKey) (string, error)

func GetPrivateKey

func GetPrivateKey(path string, out io.Writer, pr PasswordReader) (*rsa.PrivateKey, error)

func GetPublicKey

func GetPublicKey(path string) (gossh.PublicKey, error)

func GetSigner

func GetSigner(path string, out io.Writer, pr PasswordReader) (gossh.Signer, error)

func NewSSHAgentClient

func NewSSHAgentClient(sshAuthSock string) (agent.ExtendedAgent, error)

func NewSignersFunc

func NewSignersFunc(publicKey gossh.PublicKey, agentSigners []gossh.Signer) func() ([]gossh.Signer, error)

Types

type PasswordReader

type PasswordReader func(fd int) ([]byte, error)

type SSHClient

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

func NewSSHClient

func NewSSHClient(
	host string,
	port int,
	username string,
	authMethod gossh.AuthMethod,
	knownHosts string,
) (*SSHClient, error)

func (*SSHClient) Close

func (s *SSHClient) Close() error

func (*SSHClient) Run

func (s *SSHClient) Run(cmd string, out io.Writer) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳