sshagent

package
v2.0.0-...-6a2f945 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

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

Agent represents an ssh-agent

func (*Agent) Add

func (a *Agent) Add(key []byte) error

Add wraps `ssh-agent add`

func (*Agent) Pid

func (a *Agent) Pid() int

Pid is the process ID of the ssh-agent, either found in existing environment, or started by us.

func (*Agent) Run

func (a *Agent) Run() (bool, error)

Run ensures an ssh-agent is running. If ssh-agent has already been started, do nothing. If SSH_AUTH_SOCK & SSH_AGENT_PID are set, adopt those. Otherwise, start an ssh-agent, which produces output like:

SSH_AUTH_SOCK=/path/to/socket; export SSH_AUTH_SOCK;
SSH_AGENT_PID=42; export SSH_AGENT_PID;
echo Agent pid 42

The output is captured verbatim, and also parsed for those values. The SSH_AUTH_SOCK in either case is used for subsequent Add() The bool return value indicates whether the call started the agent.

func (*Agent) Stdout

func (a *Agent) Stdout() io.Reader

Stdout of the `ssh-agent -s` command.

Jump to

Keyboard shortcuts

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