Exemple #1
0
 private List<String> command(Path keyPath, String userAndHost, Integer tunnelPort) {
   List<String> command = Lists.newArrayList();
   if (System.getProperty("os.name").toLowerCase(Locale.getDefault()).contains("win")) {
     command.add("cmd");
     command.add("/C");
     command.add("start");
   }
   // send server stay live signal every 30 seconds, and accept host
   List<String> params =
       Lists.newArrayList(
           "ssh",
           "-o",
           "ServerAliveInterval=30",
           "-o",
           "StrictHostKeyChecking=no",
           "-i",
           keyPath.toString());
   if (tunnelPort != null) {
     params.add("-p");
     params.add(String.valueOf(tunnelPort));
   }
   params.add(userAndHost);
   command.addAll(params);
   return command;
 }
Exemple #2
0
 private List<String> tunnelCommand(Path keyPath, String userAndHost, String portBinding) {
   List<String> command = Lists.newArrayList();
   if (System.getProperty("os.name").toLowerCase(Locale.getDefault()).contains("win")) {
     command.add("cmd");
     command.add("/C");
     command.add("start");
   }
   command.addAll(
       Lists.newArrayList(
           "ssh",
           "-o",
           "ServerAliveInterval=30",
           "-o",
           "StrictHostKeyChecking=no",
           "-i",
           keyPath.toString(),
           "-L",
           portBinding,
           userAndHost));
   return command;
 }