Implement command-based echo app and HTTP handler

This commit is contained in:
Barak Michener 2020-09-24 14:19:31 -07:00
parent 07036afafa
commit b6b58fe2b3
6 changed files with 190 additions and 7 deletions

View file

@ -2,6 +2,7 @@ package ussher
import (
"io/ioutil"
"net/http"
"golang.org/x/crypto/ssh"
)
@ -9,6 +10,11 @@ import (
type Config struct {
HostKeyPath string
Keystore Keystore
BindAddress string
Port int
HTTPPort int
SSHApps map[string]SSHApp
HTTPMux *http.ServeMux
}
func (c *Config) GetPrivateKey() (ssh.Signer, error) {
@ -18,7 +24,3 @@ func (c *Config) GetPrivateKey() (ssh.Signer, error) {
}
return ssh.ParsePrivateKey(bytes)
}
type Keystore interface {
CheckPublicKey(user string, key ssh.PublicKey) (*ssh.Permissions, error)
}