Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAgentStopped ¶
IsAgentStopped returns true if the error indicates that the agent has been stopped
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent represents an SSH agent that manages certificates.
Concurrency: Agent is safe for concurrent use. The keyring (golang.org/x/crypto/ssh/agent) has internal synchronization and can be safely accessed from multiple goroutines. The done channel and closeOnce provide safe shutdown coordination.
Immutable after creation: agentSocketPath, publicKey, privateKey, caClient, log Protected by internal sync: keyring (uses its own locking) Protected by closeOnce: agentListener, done channel
func New ¶ added in v0.1.1
New creates a new SSH agent. This does not start listening - call Serve() to begin accepting connections. If agentSocketPath is empty, a temporary socket will be created when Serve() is called.
func (*Agent) AgentSocketPath ¶
AgentSocketPath returns the path to the agent's Unix socket
func (*Agent) Close ¶
func (a *Agent) Close()
Close stops the agent and cleans up resources. Safe to call multiple times.
func (*Agent) Done ¶ added in v0.1.1
func (a *Agent) Done() <-chan struct{}
Done returns a channel that is closed when the agent has been closed and cleanup is complete. This can be used with select statements or waitgroups to know when the agent is fully stopped.
func (*Agent) Running ¶
Running returns true if the agent is currently running and accepting connections
func (*Agent) Serve ¶ added in v0.1.1
Serve starts the agent listening on the configured socket and blocks until the context is cancelled. Returns an error if the listener cannot be started, otherwise returns ctx.Err() when shutdown completes.
func (*Agent) UseCredential ¶
func (a *Agent) UseCredential(c Credential) error
UseCredential replaces the current credentials in the agent with the provided credential
type Credential ¶
type Credential struct {
PrivateKey sshcert.RawPrivateKey
Certificate sshcert.RawCertificate
}
Credential contains the private key and certificate in PEM format