sshtest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package sshtest runs an in-process SSH server with an SFTP subsystem for tests, so connection and transfer code can be exercised without Docker or a real host.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSigner

func NewSigner(t testing.TB) ssh.Signer

NewSigner generates a fresh ed25519 key.

Types

type Options

type Options struct {
	User string // defaults to "tester"
	// Password enables password auth when non-empty.
	Password string
	// AuthorizedKeys enables public key auth for these keys.
	AuthorizedKeys []ssh.PublicKey
	// KeyboardInteractive enables a one-question challenge whose answer is
	// Password.
	KeyboardInteractive bool
	// Root is the SFTP working directory (defaults to a temp dir).
	Root string
}

Options configure which authentication methods the server accepts.

type Server

type Server struct {
	Addr    string
	Host    string
	Port    int
	User    string
	Root    string
	HostKey ssh.Signer
	// contains filtered or unexported fields
}

Server is a running test server.

func New

func New(t testing.TB, opts Options) *Server

New starts a server that is shut down when the test ends.

Jump to

Keyboard shortcuts

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