func listenTelnet(addr string) { telnetServer := telnet.Server{Addr: addr, Handler: handleTelnet} log.Printf("serving telnet on TCP %s", addr) if err := telnetServer.ListenAndServe(); err != nil { log.Fatalf("telnet server on address %s: error: %s", addr, err) } }
func ListenTelnet(addr string, cliServer *Server) { handler := func(conn net.Conn) { handleTelnet(conn, cliServer) } telnetServer := telnet.Server{Addr: addr, Handler: handler} log.Printf("serving telnet on TCP %s", addr) if err := telnetServer.ListenAndServe(); err != nil { log.Fatalf("telnet server on address %s: error: %s", addr, err) } }