testserver

package
v0.0.0-...-957db32 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package testserver runs an SSH server with an SFTP subsystem in the test process, so the remote code paths need no Docker and no real host.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	Addr        string // host:port
	Host        string
	Port        int
	Root        string // directory the SFTP subsystem serves
	Fingerprint string // SHA256 fingerprint of the host key
	ClientKey   string // path to the private key clients authenticate with
	// contains filtered or unexported fields
}

func Start

func Start(t *testing.T) *Server

Start serves a fresh temporary directory, and stops when the test ends.

func (*Server) Close

func (s *Server) Close()

Close stops accepting connections.

func (*Server) Path

func (s *Server) Path(name string) string

Path joins a name onto the server's served directory, for assertions made from the test's side of the connection.

func (*Server) RotateHostKey

func (s *Server) RotateHostKey(t *testing.T)

RotateHostKey restarts on the same port with a different host key, which is what interception looks like.

Jump to

Keyboard shortcuts

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