added support for tools/testlegitip

pull/63/head
Flavien Haas 5 years ago committed by Louis
parent 9c5bfc5430
commit d0eff567f5

@ -7,6 +7,7 @@ import tools.Directories;
import tools.Logger;
import tools.LogLevel;
import tools.TestPort;
import tools.TestLegitIP;
/** Tracker implementation
* First argument of main method is port listened by the tracker, and is mandatory.
@ -42,16 +43,20 @@ public class Tracker {
final String defaultPort = "6969";
final String defaultHostname = "localhost";
Scanner scanner = new Scanner(System.in);
TestLegitIP testLegitIP = new TestLegitIP();
TestPort testPortTracker = new TestPort();
Tracker t;
System.out.println("Tracker Server, enter hostname to bind (default = localhost): ");
String hostname = scanner.nextLine();
if(hostname.equals("")){
hostname = defaultHostname;
System.out.println("using default hostname : " + hostname);
} else{
System.out.println("using hostname : " + hostname);
}
do{
System.out.println("Tracker Server, enter hostname to bind (default = localhost): ");
String hostname = scanner.nextLine();
if(hostname.equals("")){
hostname = defaultHostname;
System.out.println("using default hostname : " + hostname);
}
} while (!testLegitIP.TestIP(hostname))
System.out.println("using hostname : " + hostname);
System.out.println("enter port (default = 6969): ");
String port = scanner.nextLine();
if(port.equals("")){
@ -60,7 +65,6 @@ public class Tracker {
} else {
System.out.println("using port : " + port);
}
TestPort testPortTracker = new TestPort();
if(testPortTracker.testPortTracker(Integer.parseInt(port))){
t = new Tracker(port);
}

Loading…
Cancel
Save