diff --git a/sshd/logger.go b/sshd/logger.go index 9f6998f..c4ebc04 100644 --- a/sshd/logger.go +++ b/sshd/logger.go @@ -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] " diff --git a/sshd/net.go b/sshd/net.go index 1b3f402..83d154f 100644 --- a/sshd/net.go +++ b/sshd/net.go @@ -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 { diff --git a/sshd/terminal.go b/sshd/terminal.go index 977e146..7e48c0b 100644 --- a/sshd/terminal.go +++ b/sshd/terminal.go @@ -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.