ssh

package
v0.0.0-...-8ed7438 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SystemConfigFile     = "/etc/ssh/ssh_config"
	SystemKnownHostsFile = "/etc/ssh/ssh_known_hosts"
	UserConfigFile       = ".ssh/config"
	UserKnownHostsFile   = ".ssh/known_hosts"
)

Variables

This section is empty.

Functions

func GetHosts

func GetHosts(useHostsFile bool) ([]string, error)

Get a sorted, deduplicated list of hosts from: - The hosts file (if `useHostsFile` is set) - SSH config files - SSH known_hosts files

Types

type AgentManager

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

An SSH agent client manager. This will connect to an already-running SSH agent, or it will attempt to spin one up internally and set it as the process.

func NewAgentManager

func NewAgentManager(log logger.Logger) (*AgentManager, error)

func (*AgentManager) Add

func (m *AgentManager) Add(key any, comment string) error

Add a key to the SSH agent.

If it already exists in the agent, then it will not be added.

For SSH servers connecting to an existing client, all explicitly added keys will be removed from the client when the manager is stopped.

func (*AgentManager) Client

func (m *AgentManager) Client() agent.ExtendedAgent

Return the instantiated client.

func (*AgentManager) Stop

func (m *AgentManager) Stop() error

Release any resources associated with the SSH agent client manager. This stops the internal agent server if it is running as well.

type UserHostPort

type UserHostPort struct {
	User string
	Host string
	Port int
}

func ParseUserHostPort

func ParseUserHostPort(s string) (*UserHostPort, error)

Jump to

Keyboard shortcuts

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