modulepackage
0.0.0-20241211234253-ab87635db30e
Repository: https://github.com/itzg/go-ssh-shell.git
Documentation: pkg.go.dev
# README
Go module that serves SSH sessions with an interactive shell. The interactive shell includes support for command history, which can be recalled using the up/down arrow keys.
Adding module
go get -u github.com/itzg/go-ssh-shell
Example
package main
import (
shell "github.com/itzg/go-ssh-shell"
"log"
)
type exampleHandler struct {
s shell.Shell
}
func exampleHandlerFactory(s *shell.Shell) shell.Handler {
return &exampleHandler{}
}
func (h *exampleHandler) HandleLine(line string) error {
log.Printf("LINE from %s: %s", h.s.InstanceName(), line)
return nil
}
func (h *exampleHandler) HandleEof() error {
log.Printf("EOF from %s", h.s.InstanceName())
return nil
}
func main() {
sshServer := &shell.SshServer{
Config: &shell.Config{
Bind: ":2222",
Users: map[string]shell.User{
"user": {Password: "notsecure"},
},
},
HandlerFactory: exampleHandlerFactory,
}
log.Fatal(sshServer.ListenAndServe())
}
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
control-D.
No description provided by the author
control-C.
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
SshServer manages acceptance of and authenticating SSH connections and delegating input to a Handler for each session instantiated by the given HandlerFactory.
No description provided by the author
# Interfaces
No description provided by the author
# Type aliases
No description provided by the author