Documentation ¶
Index ¶
- type HandleFunc
- type Option
- func WithAddr(addr string) Option
- func WithPasswordCallback(f func(ssh.ConnMetadata, []byte) (*ssh.Permissions, error)) Option
- func WithPasswordCallbackForUser(user, password string) Option
- func WithPort(port int) Option
- func WithPublicKeyCallback(f func(ssh.ConnMetadata, ssh.PublicKey) (*ssh.Permissions, error)) Option
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandleFunc ¶
type HandleFunc func(cmd string, args []string, stdin io.Reader, stdout, stderr io.Writer) (rVal int)
HnadleFunc is a handler of the sshtest server. Needs to be registered for a command (see RegisterHandler).
type Option ¶
type Option func(*sshCfg) error
Option is used to modify the ssh server behavior.
func WithPasswordCallback ¶
func WithPasswordCallback(f func(ssh.ConnMetadata, []byte) (*ssh.Permissions, error)) Option
WithPasswordCallback sets a callback used to test a user supplied password.
func WithPasswordCallbackForUser ¶
WithPasswordCallbackForUser sets a callback that grants the given user with the given password access.
func WithPublicKeyCallback ¶
func WithPublicKeyCallback(f func(ssh.ConnMetadata, ssh.PublicKey) (*ssh.Permissions, error)) Option
WithPublicKeyCallback sets a callback used to authenticate a user via a public key.
type Server ¶
Server is the SSH serving thing.
func (*Server) CheckHostKey ¶
Use this function with your client to check the servers host key.
func (*Server) RegisterHandler ¶
func (ss *Server) RegisterHandler(cmd string, f HandleFunc)
RegisterHandler will invoke the given function if the first field of the command to be executed matches the `cmd` string.