INNER CODE UNIT · Go
handleSSHHandshake
GoMudEngine/GoMud · main.go:1422
func handleSSHHandshake(conn net.Conn, sshConfig *ssh.ServerConfig, wg *sync.WaitGroup) {
defer wg.Done()
sshConn, chans, reqs, err := ssh.NewServerConn(conn, sshConfig)
if err != nil {
mudlog.Warn("SSH handshake failed", "remoteAddr", conn.RemoteAddr().String(), "error", err)
return
}
defer sshConn.Close()
// Discard all out-of-band requests (keepalive, etc.)
go ssh.DiscardRequests(reqs)
for newChan := range chans {
if newChan.ChannelType() != "session" {
newChan.Reject(ssh.UnknownChannelType, "unsupported channel type")
continue
}