sshtest

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package sshtest runs an in-process SSH server for tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option added in v1.4.0

type Option func(*config)

Option adjusts the server before it starts listening.

func WithAuthorizedKeys added in v1.4.0

func WithAuthorizedKeys(keys ...gssh.PublicKey) Option

WithAuthorizedKeys restricts public-key auth to these keys. Without it the server accepts any key.

type Server

type Server struct {
	Host         string // always 127.0.0.1
	Port         int
	IdentityFile string // private key path accepted by the server
	// contains filtered or unexported fields
}

Server is a running in-process SSH server.

func Start

func Start(opts ...Option) (*Server, error)

Start launches the server on a random localhost port.

func (*Server) Close

func (s *Server) Close()

Close stops the server and removes its temp files.

Jump to

Keyboard shortcuts

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