sftpserver

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package sftpserver is an in-process SSH+SFTP server for hermetic tests (no Docker). It serves a temp directory with password auth and an ephemeral host key.

Note: pkg/sftp's Server is not a chroot. WithServerWorkingDirectory scopes *relative* paths to the temp root; absolute paths are still honored (tests use the absolute temp path). This is test-only code.

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, e.g. 127.0.0.1:54321
	Root    string        // absolute temp dir served
	User    string        // accepted username
	Pass    string        // accepted password
	HostKey ssh.PublicKey // for building a known_hosts entry
}

Server is a running test SFTP server. Shutdown is registered with t.Cleanup: it closes the listener and waits for in-flight connections.

func Start

func Start(t *testing.T) *Server

Start launches the server on a random localhost port serving t.TempDir().

Jump to

Keyboard shortcuts

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