ssh

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package ssh contains SSH related models and methods.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseCMD

func BaseCMD() string

BaseCMD return OS specific 'ssh' command.

func ConnectCommand

func ConnectCommand(options ...Option) string

ConnectCommand - builds ssh command to connect to a remote host.

func LoadConfigCommand

func LoadConfigCommand(option OptionReadConfig) string

LoadConfigCommand - builds ssh command to load config from ssh_config file.

Types

type Config

type Config struct {
	// Values which should be extracted from 'ssh -G <hostname>' command:
	// 1. 'identityfile'
	// 2. 'user'
	// 3. 'port'
	IdentityFile string
	User         string
	Port         string
}

Config struct contains values loaded from ~/.ssh_config file.

func Parse

func Parse(config string) *Config

Parse - parses 'ssh -G <hostname> command' output and returns Config struct.

func StubConfig

func StubConfig() *Config

StubConfig - returns a stub SSH config. It is used on application startup when build application state and no hosts yet available. Consider to run real ssh process to request a config. See 'message.RunProcessLoadSSHConfig'.

type Option

type Option interface{}

Option - parent interface for command line option.

type OptionAddress

type OptionAddress struct{ Value string }

OptionAddress - is a remote host address. Example: somehost.com.

type OptionLoginName

type OptionLoginName struct{ Value string }

OptionLoginName - is a login name which is used when connecting to a remote host. Ex: loginname@somehost.com.

type OptionPrivateKey

type OptionPrivateKey struct{ Value string }

OptionPrivateKey - ssh private key path in file system.

type OptionReadConfig

type OptionReadConfig struct{ Value string }

OptionReadConfig - is used to read config file from ssh_config. Cannot be combined with other options.

type OptionRemotePort

type OptionRemotePort struct{ Value string }

OptionRemotePort - Remote port to connect to.

Jump to

Keyboard shortcuts

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