mockssh

package
v0.0.0-...-9df870d Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandHandler

type CommandHandler func(conn ssh.ConnMetadata, command string, io CommandIO) int

type CommandIO

type CommandIO struct {
	StdIn  io.Reader
	StdOut io.Writer
	StdErr io.Writer
}

type Server

type Server struct {

	// If CertChecker is nil then a default checker will be used, which checks that the
	// certificate's public key is in CertAuthorityKeys.
	CertAuthorityKeys []ssh.PublicKey
	CertChecker       ssh.CertChecker

	// RemoteEnv, RemoteDir and CommandHandler are optional configuration.
	RemoteEnv      []string
	RemoteDir      string
	CommandHandler CommandHandler
	// contains filtered or unexported fields
}

func NewServer

func NewServer(t *testing.T, authorityEndpoint string) (*Server, error)

NewServer creates and starts a local SSH server for a test. It must be stopped with the Server.Stop method. The authorityEndpoint returns SSH public keys in JSON under the key "authorities".

func (*Server) HostKeyConfig

func (s *Server) HostKeyConfig() string

func (*Server) Port

func (s *Server) Port() int

func (*Server) Stop

func (s *Server) Stop() error

Jump to

Keyboard shortcuts

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