blob: fb890282f0ebd514087a187b0ba4823ccf448fb7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
package org.gnunet.testbed;
import org.gnunet.util.Configuration;
/**
* Opaque handle to a host running experiments managed by the testing framework.
* The master process must be able to SSH to this host without password (via
* ssh-agent).
*/
public class Host {
static int nextUID = 1;
final Configuration cfg;
final String hostname;
final String username;
final int port;
private boolean controllerStarted;
/**
* Create a host to run peers and controllers on.
*
* @param hostname name of the host, use "NULL" for localhost
* @param username username to use for the login; may be NULL
* @param cfg the configuration to use as a template while starting a controller
* on this host. Operation queue sizes specific to a host are also
* read from this configuration handle
* @param port port number to use for ssh; use 0 to let ssh decide
*/
public Host(String hostname, String username, Configuration cfg, int port) {
this.port = (port == 0) ? 22 : port;
this.hostname = hostname;
this.username = username;
this.cfg = cfg;
}
/**
* Create a host handle for the local machine.
*
* @param cfg the configuration to use as a template while starting a controller
* on this host. Operation queue sizes specific to a host are also
* read from this configuration handle
* @param port port number to use for ssh; use 0 to let ssh decide
*/
public Host(Configuration cfg, int port) {
this(null, null, cfg, port);
}
public boolean isLocal() {
return hostname == null;
}
}
|