sshagent

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const EnvVarSshAuthSock = "SSH_AUTH_SOCK"

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

func NewServer

func NewServer(opts ...ServerOption) (*Server, error)

func (*Server) Agent

func (s *Server) Agent() agent.Agent

func (*Server) Listen

func (s *Server) Listen() (net.Listener, error)

Listen creates a listener on the socket file After Listen, the socket file name is available via SocketFile

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(ctx context.Context) error

ListenAndServe listens on the socket file and then calls Serve to handle requests on incoming connections. ListenAndServe blocks until the provided context.Context is cancelled

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, listener net.Listener) error

Serve accepts incoming connections on the Listener l, creating a new goroutine for each. ListenAndServe blocks until the provided context.Context is cancelled

func (*Server) SocketFile

func (s *Server) SocketFile() string

type ServerOption

type ServerOption func(*Server) error

func PrivateKey

func PrivateKey(privateKey interface{}) ServerOption

PrivateKey is an option which adds the provided private key to the agent. PrivateKey builds on agent.AddedKey privateKey must be either a *rsa.PrivateKey, *dsa.PrivateKey, *ed25519.PrivateKey or *ecdsa.PrivateKey, or if a string or []byte will be parsed before adding.

func SocketFile

func SocketFile(socketFileName string) ServerOption

func TempSocketFile

func TempSocketFile() ServerOption

type TestServer

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

TestServer helps to run a Server within tests

func NewTestServer

func NewTestServer(t *testing.T, opts ...ServerOption) *TestServer

NewTestServer returns a TestServer

func (*TestServer) Use

func (s *TestServer) Use(t *testing.T, scopeFunc func(t *testing.T))

Use ensure that the underlying Server is started before scopeFunc and shutdown afterwards. Use sets the environment variable SSH_AUTH_SOCK within the scopeFunc

Jump to

Keyboard shortcuts

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