sshtest

package
v0.6.32 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package sshtest provides an in-process SSH server exposing an SFTP subsystem, backed by a temporary directory, for exercising the libssh helpers in tests without a real fablab host.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

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

Factory is an libssh.SshConfigFactory implementation that points at a Server. It is returned as a concrete type so this package does not depend on libssh; it satisfies the interface structurally at the call site.

func (*Factory) Address

func (f *Factory) Address() string

func (*Factory) Config

func (f *Factory) Config() *ssh.ClientConfig

func (*Factory) Hostname

func (f *Factory) Hostname() string

func (*Factory) KeyPath

func (f *Factory) KeyPath() string

func (*Factory) Port

func (f *Factory) Port() int

func (*Factory) User

func (f *Factory) User() string

type Server

type Server struct {
	// Root is a temporary directory that stands in for the remote host's filesystem.
	Root string
	// contains filtered or unexported fields
}

Server is an in-process SSH+SFTP server listening on the loopback interface. Its SFTP subsystem operates on the real filesystem; tests use paths under Root.

func Start

func Start(t *testing.T) *Server

Start launches a server on 127.0.0.1 with a freshly generated host and client keypair, serving SFTP rooted (by convention) at a temporary directory. It registers cleanup with t and returns the ready server.

func (*Server) Factory

func (s *Server) Factory() *Factory

Factory returns a config factory that connects to this server.

Jump to

Keyboard shortcuts

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