title: ssh server in golang
body: <p>I am trying the <strong>github.com/gliderlabs/ssh</strong> package in order to build a ssh server.
  The example are working fine.
  The code below listen and reply some text when I connect, then close the connection.</p>
  
  <p>I would like to keep it open, listening to user input (lines) and echoing "you say : "... but I have no idea of what to do and it seems this is too simple to be explained somewhere.</p>
  
  <p>Can someone give me an indication of what to do ?</p>
  
  <pre><code>package main
  
  import (
      "bufio"
      "fmt"
      "io"
      "log"
  
      "github.com/gliderlabs/ssh"
  )
  
  func main() {
      ssh.Handle(func(s ssh.Session) {
  
          io.WriteString(s, fmt.Sprintf("Hello %s\n", s.User()))
          io.WriteString(s, fmt.Sprintf("Hello 2%s\n", s.User()))
          io.WriteString(s, fmt.Sprintf("Hello 3%s\n", s.User()))     
  
          text,err:= bufio.NewReader(s).ReadString('\n')
          if err != nil  {
              panic("GetLines: " + err.Error())
          }
  
          io.WriteString(s, fmt.Sprintf("ton texte %s\n", text))   
      })
  
      log.Println("starting ssh server on port 2223...")
      log.Fatal(ssh.ListenAndServe(":2223", nil))
  }
  </code></pre>