Documentation
¶
Index ¶
- Variables
- func NullHandler(ch ssh.Channel, in <-chan *ssh.Request)
- func RequestReplyHandler(t TestLogger, replies []RequestReply) func(ssh.Channel, <-chan *ssh.Request)
- func TestPrivateKeyAsSlice() []byte
- func TestPublicKey() ssh.PublicKey
- func TestPublicKeyAsSlice() []byte
- func TestSigner(t TestLogger) ssh.Signer
- type RequestReply
- type Server
- type StdLogger
- type TestLogger
Constants ¶
This section is empty.
Variables ¶
View Source
var PrivateKey = `` /* 443-byte string literal not displayed */
notsecret
View Source
var PublicKey = `ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJfBviRTuS3BVn5rde9xQFrmylsHb8cJdpjuJJNVzMIj user@example.com`
Functions ¶
func RequestReplyHandler ¶
func RequestReplyHandler(t TestLogger, replies []RequestReply) func(ssh.Channel, <-chan *ssh.Request)
RequestReplyHandler returns a handler that replies to requests. It fails if the request does not match the expected request.
func TestPrivateKeyAsSlice ¶
func TestPrivateKeyAsSlice() []byte
func TestPublicKey ¶
func TestPublicKeyAsSlice ¶
func TestPublicKeyAsSlice() []byte
func TestSigner ¶
func TestSigner(t TestLogger) ssh.Signer
Types ¶
type RequestReply ¶
type RequestReply struct {
// Request is a regular expression that matches the request.
Request string `yaml:"request"`
// Reply is a string that is sent back to the client.
Reply string `yaml:"reply"`
// Status is the ssh exit status code.
Status uint32 `yaml:"status,omitempty"`
// contains filtered or unexported fields
}
RequestReply is a single request-reply pair.
type Server ¶
type Server struct {
Endpoint string
Listener net.Listener
Config *ssh.ServerConfig
Handler func(ssh.Channel, <-chan *ssh.Request)
// contains filtered or unexported fields
}
func NewServerT ¶ added in v0.0.3
func NewServerT(t TestLogger, hostKey ssh.Signer) *Server
type TestLogger ¶ added in v0.0.3
type TestLogger interface {
Log(args ...any)
Logf(format string, args ...any)
Error(args ...any)
Errorf(format string, args ...any)
Fatal(args ...any)
Fatalf(format string, args ...any)
}
var TestLoggerStd TestLogger = StdLogger{}
TestLoggerStd is a standard logger that logs to the standard logger.
Click to show internal directories.
Click to hide internal directories.