sshd: Better comments
This commit is contained in:
parent
40f6957e93
commit
e6233daefd
|
@ -5,6 +5,7 @@ import stdlog "log"
|
|||
|
||||
var logger *stdlog.Logger
|
||||
|
||||
// SetLogger sets the package logging output to use w.
|
||||
func SetLogger(w io.Writer) {
|
||||
flags := stdlog.Flags()
|
||||
prefix := "[sshd] "
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"golang.org/x/crypto/ssh"
|
||||
)
|
||||
|
||||
// Container for the connection and ssh-related configuration
|
||||
// SSHListener is the container for the connection and ssh-related configuration
|
||||
type SSHListener struct {
|
||||
net.Listener
|
||||
config *ssh.ServerConfig
|
||||
|
@ -16,7 +16,7 @@ type SSHListener struct {
|
|||
HandlerFunc func(term *Terminal)
|
||||
}
|
||||
|
||||
// Make an SSH listener socket
|
||||
// ListenSSH makes an SSH listener socket
|
||||
func ListenSSH(laddr string, config *ssh.ServerConfig) (*SSHListener, error) {
|
||||
socket, err := net.Listen("tcp", laddr)
|
||||
if err != nil {
|
||||
|
@ -43,7 +43,7 @@ func (l *SSHListener) handleConn(conn net.Conn) (*Terminal, error) {
|
|||
return NewSession(sshConn, channels)
|
||||
}
|
||||
|
||||
// Accept incoming connections as terminal requests and yield them
|
||||
// Serve Accepts incoming connections as terminal requests and yield them
|
||||
func (l *SSHListener) Serve() {
|
||||
defer l.Close()
|
||||
for {
|
||||
|
|
|
@ -14,7 +14,10 @@ import (
|
|||
var keepaliveInterval = time.Second * 30
|
||||
var keepaliveRequest = "keepalive@ssh-chat"
|
||||
|
||||
// ErrNoSessionChannel is returned when there is no session channel.
|
||||
var ErrNoSessionChannel = errors.New("no session channel")
|
||||
|
||||
// ErrNotSessionChannel is returned when a channel is not a session channel.
|
||||
var ErrNotSessionChannel = errors.New("terminal requires session channel")
|
||||
|
||||
// Connection is an interface with fields necessary to operate an sshd host.
|
||||
|
|
Loading…
Reference in New Issue