Help us shape the future of Go! Take the 2026 Go Developer Survey

sshagent

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package sshagent connects to a running ssh-agent and serves an in-memory agent over a Unix socket, so keys from the vault can be used by ssh without ever being written to disk.

Index

Constants

View Source
const EnvSocket = "SSH_AUTH_SOCK"

EnvSocket is the variable OpenSSH reads the agent socket from.

Variables

View Source
var ErrNoAgent = errors.New("no ssh-agent: " + EnvSocket + " is not set (start one with 'eval $(ssh-agent)' or 'sslknife ssh agent serve')")

ErrNoAgent means SSH_AUTH_SOCK is not set.

Functions

func Listen

func Listen(path string) (net.Listener, string, func(), error)

Listen creates the agent socket. With an empty path it makes a private temporary directory; the returned cleanup removes whatever Listen created. An existing socket nobody answers on is treated as stale and replaced.

func Serve

func Serve(ctx context.Context, l net.Listener, a agent.Agent) error

Serve answers agent requests from a on l until ctx is done or l is closed.

Types

type Client

type Client struct {
	agent.ExtendedAgent
	// contains filtered or unexported fields
}

Client is a connection to an agent.

func Dial

func Dial(socket string) (*Client, error)

Dial connects to the agent at socket, or at $SSH_AUTH_SOCK when empty.

func (*Client) Close

func (c *Client) Close() error

Close closes the connection.

Jump to

Keyboard shortcuts

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