package ussher import ( "fmt" "io" "net/http" "golang.org/x/crypto/ssh" ) type echoHandler struct { count int } func (e *echoHandler) HandleExec(_ string, conn *ssh.ServerConn, channel ssh.Channel) error { e.count += 1 _, err := io.Copy(channel, channel) return err } func (e *echoHandler) Close() error { return nil } func (e *echoHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) { msg := fmt.Sprintf("Hello Echo World! Calls: %d", e.count) w.Write([]byte(msg)) } func RegisterEchoApp(conf *Config) error { e := &echoHandler{} conf.SSHApps["echo"] = e conf.HTTPMux.Handle("/echo/", e) return nil }