added the eepProxy and harvester as part of the default clientApps run on startup
(with a commented out set of lines for a heartbeat client/server) updated -cp lines accordingly use javaw for windows users (so they can close the damn dos boxes) toss the default logger logs into logs/ (say that three times fast) formatting
This commit is contained in:
@ -92,268 +92,258 @@ public abstract class Install {
|
||||
public abstract boolean confirmOption(String question, boolean defaultYes);
|
||||
|
||||
public static void main(String args[]) {
|
||||
Install install = new CliInstall();
|
||||
install.runInstall();
|
||||
Install install = new CliInstall();
|
||||
install.runInstall();
|
||||
}
|
||||
|
||||
public Install() {
|
||||
_inTCP = -2;
|
||||
_i2cpPort = -2;
|
||||
_phttpRegister = null;
|
||||
_phttpSend = null;
|
||||
_inBPS = -2;
|
||||
_outBPS = -2;
|
||||
_externalAddressIsReachable = false;
|
||||
_inTCP = -2;
|
||||
_i2cpPort = -2;
|
||||
_phttpRegister = null;
|
||||
_phttpSend = null;
|
||||
_inBPS = -2;
|
||||
_outBPS = -2;
|
||||
_externalAddressIsReachable = false;
|
||||
}
|
||||
|
||||
public void runInstall() {
|
||||
askQuestions();
|
||||
detectOS();
|
||||
configureAll();
|
||||
createConfigFile();
|
||||
createLoggerConfig();
|
||||
createStartScript();
|
||||
createReseedScript();
|
||||
createEepProxyScript();
|
||||
//createScripts("startSquid.sh", "startSquid.bat", 5555, "squid.i2p", "log-squid-#.txt", "Squid Proxy", "Squid proxying scripts written to startSquid");
|
||||
createScripts("startIrcProxy.sh", "startIrcProxy.bat", 6668, "irc.duck.i2p", "log-irc-#.txt", "IRC Proxy", "IRC proxying scripts written to startIrcProxy", "Starting IRC proxy (when you see Ready! you can connect your IRC client to localhost:6668)");
|
||||
//createScripts("startI2PCVSProxy.sh", "startI2PCVSProxy.bat", 2401, "i2pcvs.i2p", "log-i2pcvs-#.txt", "CVS Proxy", "Proxying scripts for I2P's CVS server written to startCVSProxy");
|
||||
// only pulling them temporarily, duck, until the network is
|
||||
// reliable enough
|
||||
//createScripts("startJabber.sh", "startJabber.bat", 5222, "jabber.duck.i2p", "log-jabber-#.txt", "Jabber Proxy", "Squid proxying scripts written to startSquid");
|
||||
|
||||
//createScripts("startNntpProxy.sh", "startNntpProxy.bat", 1119, "nntp.duck.i2p", "log-nntp-#.txt", "NNTP Proxy","NNTP proxying scripts written to startNntpProxy");
|
||||
createSeedNodes();
|
||||
copyLibraries();
|
||||
if (_isWindows) {
|
||||
showStatus("To run the router, please run startRouter.bat in " + _installDir.getAbsolutePath());
|
||||
} else {
|
||||
showStatus("To run the router, please run startRouter.sh in " + _installDir.getAbsolutePath());
|
||||
}
|
||||
showStatus("");
|
||||
askQuestions();
|
||||
detectOS();
|
||||
configureAll();
|
||||
createConfigFile();
|
||||
createLoggerConfig();
|
||||
createStartScript();
|
||||
createReseedScript();
|
||||
createScripts("startIrcProxy.sh", "startIrcProxy.bat", 6668, "irc.duck.i2p", "log-irc-#.txt", "IRC Proxy", "IRC proxying scripts written to startIrcProxy", "Starting IRC proxy (when you see Ready! you can connect your IRC client to localhost:6668)");
|
||||
//createScripts("startI2PCVSProxy.sh", "startI2PCVSProxy.bat", 2401, "i2pcvs.i2p", "log-i2pcvs-#.txt", "CVS Proxy", "Proxying scripts for I2P's CVS server written to startCVSProxy");
|
||||
// only pulling them temporarily, duck, until the network is
|
||||
// reliable enough
|
||||
//createScripts("startJabber.sh", "startJabber.bat", 5222, "jabber.duck.i2p", "log-jabber-#.txt", "Jabber Proxy", "Squid proxying scripts written to startSquid");
|
||||
//createScripts("startNntpProxy.sh", "startNntpProxy.bat", 1119, "nntp.duck.i2p", "log-nntp-#.txt", "NNTP Proxy","NNTP proxying scripts written to startNntpProxy");
|
||||
createSeedNodes();
|
||||
copyLibraries();
|
||||
if (_isWindows) {
|
||||
showStatus("To run the router, please run startRouter.bat in " + _installDir.getAbsolutePath());
|
||||
} else {
|
||||
showStatus("To run the router, please run startRouter.sh in " + _installDir.getAbsolutePath());
|
||||
}
|
||||
showStatus("");
|
||||
}
|
||||
|
||||
private String numberTo4Digits(int number) {
|
||||
String res = "0000"+number; // use four digit indices
|
||||
return res.substring(res.length()-4);
|
||||
String res = "0000"+number; // use four digit indices
|
||||
return res.substring(res.length()-4);
|
||||
}
|
||||
|
||||
private void askQuestions() {
|
||||
try {
|
||||
InputStream in =
|
||||
Install.class.getResourceAsStream("/install.config");
|
||||
_p = new Properties();
|
||||
_p.load(in);
|
||||
in.close();
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
int count = Integer.parseInt(_p.getProperty("qs.count"));
|
||||
_answers = new HashMap(count+count); // load factor is 0.75, so
|
||||
// there is some room left
|
||||
for (int i=1;i<=count;i++) {
|
||||
String ii = numberTo4Digits(i);
|
||||
String question = _p.getProperty("qs."+ii+".question"),
|
||||
param = _p.getProperty("qs."+ii+".param"),
|
||||
type = _p.getProperty("qs."+ii+".type"),
|
||||
def = _p.getProperty("qs."+ii+".default");
|
||||
if (question == null) continue;
|
||||
if (type == null || "info".equals(type)) {
|
||||
// just print some text
|
||||
handleOptInfo(question);
|
||||
} else if ("info_spliced".equals(type)) {
|
||||
// splice in some params already queried
|
||||
handleOptInfo(handleSpliceParams(question));
|
||||
} else if ("category".equals(type)) {
|
||||
startOptCategory(question);
|
||||
} else if ("skip".equals(type)) {
|
||||
i = Integer.parseInt(question)-1;
|
||||
} else { // a real question
|
||||
if ("<none>".equals(question)) {
|
||||
if (!setOption(i, def))
|
||||
throw new RuntimeException("Fixed and invalid value");
|
||||
} else {
|
||||
handleOption(i,question,def,type);
|
||||
}
|
||||
}
|
||||
}
|
||||
finishOptions();
|
||||
try {
|
||||
InputStream in = Install.class.getResourceAsStream("/install.config");
|
||||
_p = new Properties();
|
||||
_p.load(in);
|
||||
in.close();
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
int count = Integer.parseInt(_p.getProperty("qs.count"));
|
||||
_answers = new HashMap(count+count); // load factor is 0.75, so
|
||||
// there is some room left
|
||||
for (int i=1;i<=count;i++) {
|
||||
String ii = numberTo4Digits(i);
|
||||
String question = _p.getProperty("qs."+ii+".question"),
|
||||
param = _p.getProperty("qs."+ii+".param"),
|
||||
type = _p.getProperty("qs."+ii+".type"),
|
||||
def = _p.getProperty("qs."+ii+".default");
|
||||
if (question == null) continue;
|
||||
if (type == null || "info".equals(type)) {
|
||||
// just print some text
|
||||
handleOptInfo(question);
|
||||
} else if ("info_spliced".equals(type)) {
|
||||
// splice in some params already queried
|
||||
handleOptInfo(handleSpliceParams(question));
|
||||
} else if ("category".equals(type)) {
|
||||
startOptCategory(question);
|
||||
} else if ("skip".equals(type)) {
|
||||
i = Integer.parseInt(question)-1;
|
||||
} else { // a real question
|
||||
if ("<none>".equals(question)) {
|
||||
if (!setOption(i, def))
|
||||
throw new RuntimeException("Fixed and invalid value");
|
||||
} else {
|
||||
handleOption(i,question,def,type);
|
||||
}
|
||||
}
|
||||
}
|
||||
finishOptions();
|
||||
}
|
||||
|
||||
public /* overridable */ String handleSpliceParams(String s) {
|
||||
return spliceParams(s);
|
||||
return spliceParams(s);
|
||||
}
|
||||
|
||||
public boolean setOption(int number, String answer) {
|
||||
String ii = numberTo4Digits(number);
|
||||
String param = _p.getProperty("qs."+ii+".param"),
|
||||
type = _p.getProperty("qs."+ii+".type");
|
||||
Object value = getOptionValue(answer, type);
|
||||
if (value == null) {
|
||||
return false;
|
||||
} else {
|
||||
if (param == null || value == null)
|
||||
throw new NullPointerException();
|
||||
_answers.put(param,value);
|
||||
return true;
|
||||
}
|
||||
String ii = numberTo4Digits(number);
|
||||
String param = _p.getProperty("qs."+ii+".param"),
|
||||
type = _p.getProperty("qs."+ii+".type");
|
||||
Object value = getOptionValue(answer, type);
|
||||
if (value == null) {
|
||||
return false;
|
||||
} else {
|
||||
if (param == null || value == null)
|
||||
throw new NullPointerException();
|
||||
_answers.put(param,value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private Object getOptionValue(String answer, String type) {
|
||||
if ("string".equals(type)) {
|
||||
// everything's okay till the very end
|
||||
return answer;
|
||||
} else if ("string>0".equals(type)) {
|
||||
if (answer.length() > 0) {
|
||||
return answer;
|
||||
} else {
|
||||
showOptError("Empty answers are not allowed.");
|
||||
}
|
||||
} else if ("directory".equals(type)) {
|
||||
File f = new File(answer);
|
||||
if (f.exists()) {
|
||||
if (f.isDirectory()) {
|
||||
showOptError("Using existing target directory " + f.getAbsolutePath());
|
||||
return f;
|
||||
} else {
|
||||
showOptError("Location " + f.getAbsolutePath()+
|
||||
" is not a directory. "+
|
||||
"Lets try again");
|
||||
}
|
||||
} else {
|
||||
boolean create = confirmOption
|
||||
("Target directory " + f.getAbsolutePath() +
|
||||
" does not exist - create? ", false);
|
||||
if (!create) {
|
||||
showOptError("Lets try that again");
|
||||
} else {
|
||||
boolean created = f.mkdirs();
|
||||
if (created) {
|
||||
showOptError("Target directory " +
|
||||
f.getAbsolutePath() +
|
||||
" created");
|
||||
return f;
|
||||
} else {
|
||||
showOptError("Failed to create the "+
|
||||
"directory. Lets choose "+
|
||||
"another.");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ("boolean".equals(type)) {
|
||||
answer=answer.toLowerCase();
|
||||
if ("yes".equals(answer) || "y".equals(answer))
|
||||
answer="true";
|
||||
if ("no".equals(answer) || "n".equals(answer))
|
||||
answer="false";
|
||||
if ("true".equals(answer) || "false".equals(answer)) {
|
||||
return new Boolean("true".equals(answer));
|
||||
}
|
||||
showOptError("Incorrect boolean value, try `yes' <20>r `no'");
|
||||
} else if ("numeric".equals(type) || "port".equals(type)) {
|
||||
try {
|
||||
int num = Integer.parseInt(answer);
|
||||
if ("numeric".equals(type) ||
|
||||
(num >0 && num < 65536)) {
|
||||
return new Integer(num);
|
||||
}
|
||||
showOptError("Port number must be from 1 to 65535");
|
||||
} catch (NumberFormatException ex) {
|
||||
showOptError("Incorrect value: "+ex.getMessage());
|
||||
}
|
||||
} else if ("bandwidth".equals(type)) {
|
||||
try {
|
||||
answer = answer.toLowerCase();
|
||||
int factor = 1;
|
||||
// first check to see if it ends with m, k, or g
|
||||
if (answer.endsWith("g"))
|
||||
factor = 1024*1024*1024;
|
||||
if (answer.endsWith("m"))
|
||||
factor = 1024*1024;
|
||||
if (answer.endsWith("k"))
|
||||
factor = 1024;
|
||||
if (factor > 1)
|
||||
answer = answer.substring(0, answer.length()-1);
|
||||
int val = factor * Integer.parseInt(answer);
|
||||
if (val == -1 || val >0 ) {
|
||||
return new Integer(val);
|
||||
}
|
||||
showOptError("Value must be -1 or positive.");
|
||||
} catch (NumberFormatException ex) {
|
||||
showOptError("Invalid number [" + answer + "]. Valid numbers are of the form -1, 42, 68k, 7m, 9g");
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException ("cannot read installer option: " + type);
|
||||
}
|
||||
return null;
|
||||
if ("string".equals(type)) {
|
||||
// everything's okay till the very end
|
||||
return answer;
|
||||
} else if ("string>0".equals(type)) {
|
||||
if (answer.length() > 0) {
|
||||
return answer;
|
||||
} else {
|
||||
showOptError("Empty answers are not allowed.");
|
||||
}
|
||||
} else if ("directory".equals(type)) {
|
||||
File f = new File(answer);
|
||||
if (f.exists()) {
|
||||
if (f.isDirectory()) {
|
||||
showOptError("Using existing target directory " + f.getAbsolutePath());
|
||||
return f;
|
||||
} else {
|
||||
showOptError("Location " + f.getAbsolutePath()+
|
||||
" is not a directory. "+
|
||||
"Lets try again");
|
||||
}
|
||||
} else {
|
||||
boolean create = confirmOption("Target directory " + f.getAbsolutePath() +
|
||||
" does not exist - create? ", false);
|
||||
if (!create) {
|
||||
showOptError("Lets try that again");
|
||||
} else {
|
||||
boolean created = f.mkdirs();
|
||||
if (created) {
|
||||
showOptError("Target directory " + f.getAbsolutePath() +
|
||||
" created");
|
||||
return f;
|
||||
} else {
|
||||
showOptError("Failed to create the "+
|
||||
"directory. Lets choose another.");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ("boolean".equals(type)) {
|
||||
answer=answer.toLowerCase();
|
||||
if ("yes".equals(answer) || "y".equals(answer))
|
||||
answer="true";
|
||||
if ("no".equals(answer) || "n".equals(answer))
|
||||
answer="false";
|
||||
if ("true".equals(answer) || "false".equals(answer)) {
|
||||
return new Boolean("true".equals(answer));
|
||||
}
|
||||
showOptError("Incorrect boolean value, try `yes' <20>r `no'");
|
||||
} else if ("numeric".equals(type) || "port".equals(type)) {
|
||||
try {
|
||||
int num = Integer.parseInt(answer);
|
||||
if ("numeric".equals(type) ||
|
||||
(num >0 && num < 65536)) {
|
||||
return new Integer(num);
|
||||
}
|
||||
showOptError("Port number must be from 1 to 65535");
|
||||
} catch (NumberFormatException ex) {
|
||||
showOptError("Incorrect value: "+ex.getMessage());
|
||||
}
|
||||
} else if ("bandwidth".equals(type)) {
|
||||
try {
|
||||
answer = answer.toLowerCase();
|
||||
int factor = 1;
|
||||
// first check to see if it ends with m, k, or g
|
||||
if (answer.endsWith("g"))
|
||||
factor = 1024*1024*1024;
|
||||
if (answer.endsWith("m"))
|
||||
factor = 1024*1024;
|
||||
if (answer.endsWith("k"))
|
||||
factor = 1024;
|
||||
if (factor > 1)
|
||||
answer = answer.substring(0, answer.length()-1);
|
||||
int val = factor * Integer.parseInt(answer);
|
||||
if (val == -1 || val >0 ) {
|
||||
return new Integer(val);
|
||||
}
|
||||
showOptError("Value must be -1 or positive.");
|
||||
} catch (NumberFormatException ex) {
|
||||
showOptError("Invalid number [" + answer + "]. Valid numbers are of the form -1, 42, 68k, 7m, 9g");
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException ("cannot read installer option: " + type);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String spliceParams(String s) {
|
||||
StringBuffer txt = new StringBuffer(s.length()+100);
|
||||
int ind;
|
||||
while((ind = s.indexOf("##")) != -1) {
|
||||
txt.append(s.substring(0,ind));
|
||||
String temp = s.substring(ind+2);
|
||||
ind = temp.indexOf("##");
|
||||
if (ind == -1) throw new RuntimeException
|
||||
("Incorrect info_spliced param");
|
||||
s=temp.substring(ind+2);
|
||||
Object value = _answers.get(temp.substring(0,ind));
|
||||
if (value == null) {
|
||||
System.err.println("ERROR: Could not insert parameter "+temp.substring(0,ind));
|
||||
System.exit(1);
|
||||
} else {
|
||||
txt.append(value.toString());
|
||||
}
|
||||
}
|
||||
txt.append(s);
|
||||
return txt.toString();
|
||||
StringBuffer txt = new StringBuffer(s.length()+100);
|
||||
int ind;
|
||||
while((ind = s.indexOf("##")) != -1) {
|
||||
txt.append(s.substring(0,ind));
|
||||
String temp = s.substring(ind+2);
|
||||
ind = temp.indexOf("##");
|
||||
if (ind == -1) throw new RuntimeException("Incorrect info_spliced param");
|
||||
s=temp.substring(ind+2);
|
||||
Object value = _answers.get(temp.substring(0,ind));
|
||||
if (value == null) {
|
||||
System.err.println("ERROR: Could not insert parameter "+temp.substring(0,ind));
|
||||
System.exit(1);
|
||||
} else {
|
||||
txt.append(value.toString());
|
||||
}
|
||||
}
|
||||
txt.append(s);
|
||||
return txt.toString();
|
||||
}
|
||||
|
||||
private void detectOS() {
|
||||
String os = System.getProperty("os.name");
|
||||
if (os.toLowerCase().indexOf("win") != -1)
|
||||
_isWindows = true;
|
||||
else
|
||||
_isWindows = false;
|
||||
// yes, this treats pre-os-x macs as unix, and perhaps some
|
||||
// windows-esque OSes don't have "win" in their name, or some
|
||||
// unix-esque OS does. fix when it occurs.
|
||||
String os = System.getProperty("os.name");
|
||||
if (os.toLowerCase().indexOf("win") != -1)
|
||||
_isWindows = true;
|
||||
else
|
||||
_isWindows = false;
|
||||
// yes, this treats pre-os-x macs as unix, and perhaps some
|
||||
// windows-esque OSes don't have "win" in their name, or some
|
||||
// unix-esque OS does. fix when it occurs.
|
||||
}
|
||||
|
||||
private void configureAll() {
|
||||
_installDir = (File) _answers.get("installDir");
|
||||
_externalAddress = _answers.get("externalAddress").toString();
|
||||
_externalAddressIsReachable = ((Boolean)_answers.get("externalAddressIsReachable")).booleanValue();
|
||||
|
||||
_inTCP=((Integer)_answers.get("inTCP")).intValue();
|
||||
_phttpRegister = _answers.get("phttpRegister").toString();
|
||||
_phttpSend = _answers.get("phttpSend").toString();
|
||||
_i2cpPort = ((Integer)_answers.get("i2cpPort")).intValue();
|
||||
_inBPS = ((Integer)_answers.get("inBPS")).intValue();
|
||||
_outBPS = ((Integer)_answers.get("outBPS")).intValue();
|
||||
_installDir = (File) _answers.get("installDir");
|
||||
_externalAddress = _answers.get("externalAddress").toString();
|
||||
_externalAddressIsReachable = ((Boolean)_answers.get("externalAddressIsReachable")).booleanValue();
|
||||
|
||||
_inTCP=((Integer)_answers.get("inTCP")).intValue();
|
||||
_phttpRegister = _answers.get("phttpRegister").toString();
|
||||
_phttpSend = _answers.get("phttpSend").toString();
|
||||
_i2cpPort = ((Integer)_answers.get("i2cpPort")).intValue();
|
||||
_inBPS = ((Integer)_answers.get("inBPS")).intValue();
|
||||
_outBPS = ((Integer)_answers.get("outBPS")).intValue();
|
||||
}
|
||||
|
||||
private void useTemplate(String templateName, File destFile) {
|
||||
try {
|
||||
BufferedWriter bw = new BufferedWriter(new FileWriter(destFile));
|
||||
BufferedReader br = new BufferedReader
|
||||
(new InputStreamReader
|
||||
(Install.class.getResourceAsStream(templateName)));
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
if (!line.startsWith("####")) {
|
||||
bw.write(spliceParams(line));
|
||||
bw.newLine();
|
||||
}
|
||||
}
|
||||
br.close();
|
||||
bw.close();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
System.exit(0);
|
||||
}
|
||||
try {
|
||||
BufferedWriter bw = new BufferedWriter(new FileWriter(destFile));
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(Install.class.getResourceAsStream(templateName)));
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
if (!line.startsWith("####")) {
|
||||
bw.write(spliceParams(line));
|
||||
bw.newLine();
|
||||
}
|
||||
}
|
||||
br.close();
|
||||
bw.close();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
private void createLoggerConfig() {
|
||||
@ -364,249 +354,243 @@ public abstract class Install {
|
||||
}
|
||||
|
||||
private void createSeedNodes() {
|
||||
showStatus("To connect to I2P, you will need a reference to at least one other I2P router");
|
||||
showStatus("Rather than bundle some (soon to be out of date) references with the software, ");
|
||||
showStatus("you can either run the included reseed script or get get your own references ");
|
||||
showStatus("from some out of band location. ");
|
||||
showStatus("");
|
||||
showStatus("The reseed script simply connects to http://i2p.net/i2pdb/ and downloads all");
|
||||
showStatus("of the routerInfo-*.dat files and save them into " + (new File(_installDir, "i2pdb")).getAbsolutePath());
|
||||
showStatus("That ../i2pdb/ directory is simply a mirror of one router's netDb directory, so those files");
|
||||
showStatus("can come from anyone else too");
|
||||
showStatus("");
|
||||
showStatus("You can run the reseed script or download references (from your friends, etc) as often");
|
||||
showStatus("as you like without restarting your router. If you find your netDb directory to have ");
|
||||
showStatus("only one file in it (thats your router info), you will need more peers to get anything done.");
|
||||
showStatus("");
|
||||
boolean reseed = confirmOption("Do you want to run the reseed script now? ", true);
|
||||
if (reseed) {
|
||||
reseed();
|
||||
} else {
|
||||
showStatus("Ok ok, not reseeding - but please reseed before running the router");
|
||||
}
|
||||
showStatus("To connect to I2P, you will need a reference to at least one other I2P router");
|
||||
showStatus("Rather than bundle some (soon to be out of date) references with the software, ");
|
||||
showStatus("you can either run the included reseed script or get get your own references ");
|
||||
showStatus("from some out of band location. ");
|
||||
showStatus("");
|
||||
showStatus("The reseed script simply connects to http://i2p.net/i2pdb/ and downloads all");
|
||||
showStatus("of the routerInfo-*.dat files and save them into " + (new File(_installDir, "i2pdb")).getAbsolutePath());
|
||||
showStatus("That ../i2pdb/ directory is simply a mirror of one router's netDb directory, so those files");
|
||||
showStatus("can come from anyone else too");
|
||||
showStatus("");
|
||||
showStatus("You can run the reseed script or download references (from your friends, etc) as often");
|
||||
showStatus("as you like without restarting your router. If you find your netDb directory to have ");
|
||||
showStatus("only one file in it (thats your router info), you will need more peers to get anything done.");
|
||||
showStatus("");
|
||||
boolean reseed = confirmOption("Do you want to run the reseed script now? ", true);
|
||||
if (reseed) {
|
||||
reseed();
|
||||
} else {
|
||||
showStatus("Ok ok, not reseeding - but please reseed before running the router");
|
||||
}
|
||||
}
|
||||
|
||||
private void reseed() {
|
||||
try {
|
||||
URL dir = new URL("http://i2p.net/i2pdb/");
|
||||
String content = new String(readURL(dir));
|
||||
Set urls = new HashSet();
|
||||
int cur = 0;
|
||||
while (true) {
|
||||
int start = content.indexOf("href=\"routerInfo-", cur);
|
||||
if (start < 0)
|
||||
break;
|
||||
|
||||
int end = content.indexOf(".dat\">", start);
|
||||
String name = content.substring(start+"href=\"routerInfo-".length(), end);
|
||||
urls.add(name);
|
||||
cur = end + 1;
|
||||
}
|
||||
|
||||
for (Iterator iter = urls.iterator(); iter.hasNext(); ) {
|
||||
fetchSeed((String)iter.next());
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
showStatus("Error reseeding - " + t.getMessage());
|
||||
}
|
||||
try {
|
||||
URL dir = new URL("http://i2p.net/i2pdb/");
|
||||
String content = new String(readURL(dir));
|
||||
Set urls = new HashSet();
|
||||
int cur = 0;
|
||||
while (true) {
|
||||
int start = content.indexOf("href=\"routerInfo-", cur);
|
||||
if (start < 0)
|
||||
break;
|
||||
|
||||
int end = content.indexOf(".dat\">", start);
|
||||
String name = content.substring(start+"href=\"routerInfo-".length(), end);
|
||||
urls.add(name);
|
||||
cur = end + 1;
|
||||
}
|
||||
|
||||
for (Iterator iter = urls.iterator(); iter.hasNext(); ) {
|
||||
fetchSeed((String)iter.next());
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
showStatus("Error reseeding - " + t.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void fetchSeed(String peer) throws Exception {
|
||||
URL url = new URL("http://i2p.net/i2pdb/routerInfo-" + peer + ".dat");
|
||||
showStatus("Fetching seed from " + url.toExternalForm());
|
||||
|
||||
byte data[] = readURL(url);
|
||||
writeSeed(peer, data);
|
||||
URL url = new URL("http://i2p.net/i2pdb/routerInfo-" + peer + ".dat");
|
||||
showStatus("Fetching seed from " + url.toExternalForm());
|
||||
|
||||
byte data[] = readURL(url);
|
||||
writeSeed(peer, data);
|
||||
}
|
||||
|
||||
private byte[] readURL(URL url) throws Exception {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
|
||||
URLConnection con = url.openConnection();
|
||||
InputStream in = con.getInputStream();
|
||||
byte buf[] = new byte[1024];
|
||||
while (true) {
|
||||
int read = in.read(buf);
|
||||
if (read < 0)
|
||||
break;
|
||||
baos.write(buf, 0, read);
|
||||
}
|
||||
in.close();
|
||||
return baos.toByteArray();
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
|
||||
URLConnection con = url.openConnection();
|
||||
InputStream in = con.getInputStream();
|
||||
byte buf[] = new byte[1024];
|
||||
while (true) {
|
||||
int read = in.read(buf);
|
||||
if (read < 0)
|
||||
break;
|
||||
baos.write(buf, 0, read);
|
||||
}
|
||||
in.close();
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
private void writeSeed(String name, byte data[]) throws Exception {
|
||||
File netDbDir = new File(_installDir, "netDb");
|
||||
if (!netDbDir.exists())
|
||||
netDbDir.mkdirs();
|
||||
FileOutputStream fos = new FileOutputStream(new File(netDbDir, "routerInfo-" + name + ".dat"));
|
||||
fos.write(data);
|
||||
fos.close();
|
||||
File netDbDir = new File(_installDir, "netDb");
|
||||
if (!netDbDir.exists())
|
||||
netDbDir.mkdirs();
|
||||
FileOutputStream fos = new FileOutputStream(new File(netDbDir, "routerInfo-" + name + ".dat"));
|
||||
fos.write(data);
|
||||
fos.close();
|
||||
}
|
||||
|
||||
private void copyLibraries() {
|
||||
File libDir = new File(_installDir, "lib");
|
||||
if (!libDir.exists()) {
|
||||
boolean libCreated = libDir.mkdirs();
|
||||
if (!libCreated) {
|
||||
showStatus("Error creating library directory " + libDir.getAbsolutePath());
|
||||
return;
|
||||
}
|
||||
}
|
||||
showStatus("Installing the libraries into " + libDir.getAbsolutePath());
|
||||
int cnt = Integer.parseInt(_p.getProperty("libs.count"));
|
||||
try {
|
||||
for (int i=1;i<=cnt;i++) {
|
||||
String ii = numberTo4Digits(i),
|
||||
file = _p.getProperty("libs."+ii+".name");
|
||||
boolean isLib = "true".equals(_p.getProperty("libs."+ii+".islib"));
|
||||
InputStream is = Install.class.getResourceAsStream("/"+file);
|
||||
if (is == null) throw new IOException("Resource /"+file+" not found");
|
||||
copyFile(is, file, isLib?libDir:_installDir);
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
showStatus("Error extracting the libraries: " + ioe.getMessage());
|
||||
}
|
||||
File dbDir = new File(_installDir, "netDb");
|
||||
dbDir.mkdirs();
|
||||
File logDir = new File(_installDir, "logs");
|
||||
logDir.mkdirs();
|
||||
File libDir = new File(_installDir, "lib");
|
||||
if (!libDir.exists()) {
|
||||
boolean libCreated = libDir.mkdirs();
|
||||
if (!libCreated) {
|
||||
showStatus("Error creating library directory " + libDir.getAbsolutePath());
|
||||
return;
|
||||
}
|
||||
}
|
||||
showStatus("Installing the libraries into " + libDir.getAbsolutePath());
|
||||
int cnt = Integer.parseInt(_p.getProperty("libs.count"));
|
||||
try {
|
||||
for (int i=1;i<=cnt;i++) {
|
||||
String ii = numberTo4Digits(i),
|
||||
file = _p.getProperty("libs."+ii+".name");
|
||||
boolean isLib = "true".equals(_p.getProperty("libs."+ii+".islib"));
|
||||
InputStream is = Install.class.getResourceAsStream("/"+file);
|
||||
if (is == null) throw new IOException("Resource /"+file+" not found");
|
||||
copyFile(is, file, isLib?libDir:_installDir);
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
showStatus("Error extracting the libraries: " + ioe.getMessage());
|
||||
}
|
||||
File dbDir = new File(_installDir, "netDb");
|
||||
dbDir.mkdirs();
|
||||
File logDir = new File(_installDir, "logs");
|
||||
logDir.mkdirs();
|
||||
}
|
||||
|
||||
private void copyFile(InputStream in, String name, File destDir) {
|
||||
File destFile = new File(destDir, name);
|
||||
try {
|
||||
byte buf[] = new byte[16*1024];
|
||||
FileOutputStream out = new FileOutputStream(destFile);
|
||||
while (true) {
|
||||
int read = in.read(buf);
|
||||
if (read == -1)
|
||||
break;
|
||||
out.write(buf, 0, read);
|
||||
}
|
||||
in.close();
|
||||
out.close();
|
||||
showStatus("Installed file " + destFile.getName() + " in " + destFile.getParent());
|
||||
} catch (IOException ioe) {
|
||||
showStatus("Error saving " + name + " to " + destFile.getAbsolutePath() + ": " + ioe.getMessage());
|
||||
}
|
||||
File destFile = new File(destDir, name);
|
||||
try {
|
||||
byte buf[] = new byte[16*1024];
|
||||
FileOutputStream out = new FileOutputStream(destFile);
|
||||
while (true) {
|
||||
int read = in.read(buf);
|
||||
if (read == -1)
|
||||
break;
|
||||
out.write(buf, 0, read);
|
||||
}
|
||||
in.close();
|
||||
out.close();
|
||||
showStatus("Installed file " + destFile.getName() + " in " + destFile.getParent());
|
||||
} catch (IOException ioe) {
|
||||
showStatus("Error saving " + name + " to " + destFile.getAbsolutePath()
|
||||
+ ": " + ioe.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void createLogConfigOptions(boolean verbose) {
|
||||
_answers.put("_logger_level", verbose?"DEBUG":"INFO");
|
||||
_answers.put("_logger_level2", verbose?"WARN":"ERROR");
|
||||
StringBuffer buf = new StringBuffer();
|
||||
if (!verbose) {
|
||||
// overrides for particularly chatty classes
|
||||
_answers.put("_logger_notverbose",
|
||||
"logger.record.net.i2p.router.transport.Triv=ERROR"+NL+
|
||||
"logger.record.net.i2p.router.transport.Band=ERROR"+NL+
|
||||
"logger.record.net.i2p.crypto=ERROR" +NL+
|
||||
"logger.record.net.i2p.crypto.DH=ERROR");
|
||||
} else {
|
||||
_answers.put("_logger_notverbose","");
|
||||
}
|
||||
_answers.put("_logger_level", verbose?"DEBUG":"INFO");
|
||||
_answers.put("_logger_level2", verbose?"WARN":"ERROR");
|
||||
StringBuffer buf = new StringBuffer();
|
||||
if (!verbose) {
|
||||
// overrides for particularly chatty classes
|
||||
_answers.put("_logger_notverbose", "logger.record.net.i2p.router.transport.Triv=ERROR"+NL+
|
||||
"logger.record.net.i2p.router.transport.Band=ERROR"+NL+
|
||||
"logger.record.net.i2p.crypto=ERROR" +NL+
|
||||
"logger.record.net.i2p.crypto.DH=ERROR");
|
||||
} else {
|
||||
_answers.put("_logger_notverbose","");
|
||||
}
|
||||
}
|
||||
|
||||
private void createScripts(String unixName, String windowsName, int listenPort, String targetDest, String logfilePattern, String windowTitle, String message, String scriptMessage) {
|
||||
createScripts(unixName, windowsName, "client "+listenPort+" "+targetDest, logfilePattern, windowTitle, message, scriptMessage);
|
||||
private void createScripts(String unixName, String windowsName, int listenPort,
|
||||
String targetDest, String logfilePattern, String windowTitle,
|
||||
String message, String scriptMessage) {
|
||||
createScripts(unixName, windowsName, "client "+listenPort+" "+targetDest,
|
||||
logfilePattern, windowTitle, message, scriptMessage);
|
||||
}
|
||||
|
||||
private void createScripts(String unixName, String windowsName, String command, String logfilePattern, String windowTitle, String message, String scriptMessage) {
|
||||
_answers.put("_scripts_port", ""+_i2cpPort);
|
||||
_answers.put("_scripts_cmd", command);
|
||||
_answers.put("_scripts_logname", logfilePattern);
|
||||
_answers.put("_scripts_winttl", windowTitle);
|
||||
_answers.put("_scripts_message", scriptMessage);
|
||||
if (_isWindows) {
|
||||
File windowsFile = new File(_installDir, windowsName);
|
||||
useTemplate("startFoo.bat.template", windowsFile);
|
||||
} else {
|
||||
File unixFile = new File(_installDir, unixName);
|
||||
useTemplate("startFoo.sh.template", unixFile);
|
||||
chmodaplusx(unixFile);
|
||||
}
|
||||
showStatus(message);
|
||||
}
|
||||
|
||||
private void createEepProxyScript() {
|
||||
StringBuffer buf = new StringBuffer(512);
|
||||
buf.append("Eepsite proxying scripts written to startEepProxy").append(NL);
|
||||
buf.append("IMPORTANT: While this installer packages the latest hosts.txt file available at the time ($Date: 2004/03/25 00:56:23 $), ").append(NL);
|
||||
buf.append("a more recently updated one may be available. You can check for updates by fetching the file ").append(NL);
|
||||
buf.append("http://i2p.net/i2p/hosts.txt and saving it in ").append(_installDir.getAbsolutePath()).append(NL);
|
||||
buf.append("Or, of course, you can edit and update hosts.txt yourself to include mappings of your liking").append(NL);
|
||||
|
||||
createScripts("startEepProxy.sh", "startEepProxy.bat", "httpclient 4444", "log-eepProxy-#.txt", "Eep Proxy", buf.toString(), "Starting EepProxy (when you see Ready, set your browsers HTTP proxy to localhost:4444)");
|
||||
private void createScripts(String unixName, String windowsName, String command,
|
||||
String logfilePattern, String windowTitle, String message,
|
||||
String scriptMessage) {
|
||||
_answers.put("_scripts_port", ""+_i2cpPort);
|
||||
_answers.put("_scripts_cmd", command);
|
||||
_answers.put("_scripts_logname", logfilePattern);
|
||||
_answers.put("_scripts_winttl", windowTitle);
|
||||
_answers.put("_scripts_message", scriptMessage);
|
||||
if (_isWindows) {
|
||||
File windowsFile = new File(_installDir, windowsName);
|
||||
useTemplate("startFoo.bat.template", windowsFile);
|
||||
} else {
|
||||
File unixFile = new File(_installDir, unixName);
|
||||
useTemplate("startFoo.sh.template", unixFile);
|
||||
chmodaplusx(unixFile);
|
||||
}
|
||||
showStatus(message);
|
||||
}
|
||||
|
||||
private void createReseedScript() {
|
||||
if (_isWindows) {
|
||||
File windowsFile = new File(_installDir, "reseed.bat");
|
||||
useTemplate("reseed.bat.template", windowsFile);
|
||||
} else {
|
||||
File unixFile = new File(_installDir, "reseed.sh");
|
||||
useTemplate("reseed.sh.template", unixFile);
|
||||
chmodaplusx(unixFile);
|
||||
}
|
||||
if (_isWindows) {
|
||||
File windowsFile = new File(_installDir, "reseed.bat");
|
||||
useTemplate("reseed.bat.template", windowsFile);
|
||||
} else {
|
||||
File unixFile = new File(_installDir, "reseed.sh");
|
||||
useTemplate("reseed.sh.template", unixFile);
|
||||
chmodaplusx(unixFile);
|
||||
}
|
||||
}
|
||||
|
||||
private void chmodaplusx(File f) {
|
||||
try {
|
||||
Runtime.getRuntime().exec("chmod a+x " + f.getAbsolutePath());
|
||||
} catch (IOException ioe) {
|
||||
showStatus("Error setting "+f.getName()+" as executable");
|
||||
}
|
||||
try {
|
||||
Runtime.getRuntime().exec("chmod a+x " + f.getAbsolutePath());
|
||||
} catch (IOException ioe) {
|
||||
showStatus("Error setting "+f.getName()+" as executable");
|
||||
}
|
||||
}
|
||||
|
||||
private void createStartScript() {
|
||||
_answers.put("_scripts_installdir", _installDir.getAbsolutePath());
|
||||
if (_isWindows) {
|
||||
File windowsFile = new File(_installDir, "startRouter.bat");
|
||||
useTemplate("startRouter.bat.template", windowsFile);
|
||||
} else {
|
||||
File unixFile = new File(_installDir, "startRouter.sh");
|
||||
useTemplate("startRouter.sh.template", unixFile);
|
||||
File unixStopFile = new File(_installDir, "stopRouter.sh");
|
||||
useTemplate("stopRouter.sh.template", unixStopFile);
|
||||
chmodaplusx(unixFile);
|
||||
chmodaplusx(unixStopFile);
|
||||
}
|
||||
_answers.put("_scripts_installdir", _installDir.getAbsolutePath());
|
||||
if (_isWindows) {
|
||||
File windowsFile = new File(_installDir, "startRouter.bat");
|
||||
useTemplate("startRouter.bat.template", windowsFile);
|
||||
} else {
|
||||
File unixFile = new File(_installDir, "startRouter.sh");
|
||||
useTemplate("startRouter.sh.template", unixFile);
|
||||
File unixStopFile = new File(_installDir, "stopRouter.sh");
|
||||
useTemplate("stopRouter.sh.template", unixStopFile);
|
||||
chmodaplusx(unixFile);
|
||||
chmodaplusx(unixStopFile);
|
||||
}
|
||||
}
|
||||
|
||||
private void createConfigFile() {
|
||||
File configFile = new File(_installDir, "router.config");
|
||||
setConfigFileOptions();
|
||||
useTemplate("router.config.template", configFile);
|
||||
showStatus("Router configuration file written to " + configFile.getAbsolutePath());
|
||||
showStatus("");
|
||||
File configFile = new File(_installDir, "router.config");
|
||||
setConfigFileOptions();
|
||||
useTemplate("router.config.template", configFile);
|
||||
showStatus("Router configuration file written to " + configFile.getAbsolutePath());
|
||||
showStatus("");
|
||||
}
|
||||
|
||||
private final static String NL = System.getProperty("line.separator");
|
||||
|
||||
|
||||
private void setConfigFileOptions() {
|
||||
// set fields needed for the config template
|
||||
_answers.put("NOW", new Date().toString());
|
||||
if (_inTCP <= 0) {
|
||||
_answers.put("_router_hn", "#i2np.tcp.hostname=[externally reachable hostname or IP address goes here]");
|
||||
_answers.put("_router_port", "#i2np.tcp.port=[TCP/IP port number]");
|
||||
_answers.put("_router_lavalid","#i2np.tcp.listenAddressIsValid=[true/false for whether your external address is locally reachable]");
|
||||
_answers.put("_router_tcpdisable","#i2np.tcp.disable=[true/false for whether you want absolutely no tcp connections to be established (forcing phttp, etc)])");
|
||||
} else {
|
||||
_answers.put("_router_hn","i2np.tcp.hostname="+_externalAddress);
|
||||
_answers.put("_router_port","i2np.tcp.port="+_inTCP);
|
||||
_answers.put("_router_lavalid","i2np.tcp.listenAddressIsValid="+_externalAddressIsReachable);
|
||||
_answers.put("_router_tcpdisable","i2np.tcp.disable=false");
|
||||
}
|
||||
if ( (_phttpRegister == null) || (_phttpSend == null) ) {
|
||||
_answers.put("_router_phttpreg","#i2np.phttp.registerURL=[full URL to a PHTTP registration server, e.g. http://someHost:8080/phttprelay/phttpRegister]");
|
||||
_answers.put("_router_phttpsend","#i2np.phttp.sendURL=[full URL to a PHTTP relay server, e.g. http://someHost:8080/phttprelay/phttpSend]");
|
||||
} else {
|
||||
_answers.put("_router_phttpreg","i2np.phttp.registerURL="+_phttpRegister);
|
||||
_answers.put("_router_phttpsend","i2np.phttp.sendURL="+_phttpSend);
|
||||
}
|
||||
_answers.put("_router_i2cp_port",""+_i2cpPort);
|
||||
_answers.put("_router_inbps",""+(_inBPS*60));
|
||||
_answers.put("_router_outbps",""+(_outBPS*60));
|
||||
// set fields needed for the config template
|
||||
_answers.put("NOW", new Date().toString());
|
||||
if (_inTCP <= 0) {
|
||||
_answers.put("_router_hn", "#i2np.tcp.hostname=[externally reachable hostname or IP address goes here]");
|
||||
_answers.put("_router_port", "#i2np.tcp.port=[TCP/IP port number]");
|
||||
_answers.put("_router_lavalid","#i2np.tcp.listenAddressIsValid=[true/false for whether your external address is locally reachable]");
|
||||
_answers.put("_router_tcpdisable","#i2np.tcp.disable=[true/false for whether you want absolutely no tcp connections to be established (forcing phttp, etc)])");
|
||||
} else {
|
||||
_answers.put("_router_hn","i2np.tcp.hostname="+_externalAddress);
|
||||
_answers.put("_router_port","i2np.tcp.port="+_inTCP);
|
||||
_answers.put("_router_lavalid","i2np.tcp.listenAddressIsValid="+_externalAddressIsReachable);
|
||||
_answers.put("_router_tcpdisable","i2np.tcp.disable=false");
|
||||
}
|
||||
if ( (_phttpRegister == null) || (_phttpSend == null) ) {
|
||||
_answers.put("_router_phttpreg","#i2np.phttp.registerURL=[full URL to a PHTTP registration server, e.g. http://someHost:8080/phttprelay/phttpRegister]");
|
||||
_answers.put("_router_phttpsend","#i2np.phttp.sendURL=[full URL to a PHTTP relay server, e.g. http://someHost:8080/phttprelay/phttpSend]");
|
||||
} else {
|
||||
_answers.put("_router_phttpreg","i2np.phttp.registerURL="+_phttpRegister);
|
||||
_answers.put("_router_phttpsend","i2np.phttp.sendURL="+_phttpSend);
|
||||
}
|
||||
_answers.put("_router_i2cp_port",""+_i2cpPort);
|
||||
_answers.put("_router_inbps",""+(_inBPS*60));
|
||||
_answers.put("_router_outbps",""+(_outBPS*60));
|
||||
}
|
||||
}
|
||||
|
155
installer/java/src/harvester.config
Normal file
155
installer/java/src/harvester.config
Normal file
@ -0,0 +1,155 @@
|
||||
# Configure what data points the netmonitor app will harvest from
|
||||
# the network database.
|
||||
#
|
||||
# You probably don't want to edit this.
|
||||
#
|
||||
statGroup.0.name=dropped
|
||||
statGroup.0.detail.0.name=num dropped jobs (minute)
|
||||
statGroup.0.detail.0.option=stat_jobQueue.droppedJobs.60m
|
||||
statGroup.0.detail.0.field=3
|
||||
statGroup.0.detail.1.name=num dropped jobs (hour)
|
||||
statGroup.0.detail.1.option=stat_jobQueue.droppedJobs.60h
|
||||
statGroup.0.detail.1.field=3
|
||||
statGroup.0.detail.2.name=num dropped messages (minute)
|
||||
statGroup.0.detail.2.option=stat_inNetPool.dropped.60m
|
||||
statGroup.0.detail.2.field=3
|
||||
statGroup.0.detail.3.name=num dropped messages (hour)
|
||||
statGroup.0.detail.3.option=stat_inNetPool.dropped.60h
|
||||
statGroup.0.detail.3.field=3
|
||||
#
|
||||
statGroup.1.name=encryptTime
|
||||
statGroup.1.detail.0.name=encryption time avg ms (minute)
|
||||
statGroup.1.detail.0.option=stat_crypto.elGamal.encrypt.60s
|
||||
statGroup.1.detail.0.field=0
|
||||
statGroup.1.detail.1.name=num encryptions (minute)
|
||||
statGroup.1.detail.1.option=stat_crypto.elGamal.encrypt.60s
|
||||
statGroup.1.detail.1.field=7
|
||||
statGroup.1.detail.2.name=encryption time avg ms (hour)
|
||||
statGroup.1.detail.2.option=stat_crypto.elGamal.encrypt.60s
|
||||
statGroup.1.detail.2.field=0
|
||||
statGroup.1.detail.3.name=num encryptions (hour)
|
||||
statGroup.1.detail.3.option=stat_crypto.elGamal.encrypt.60s
|
||||
statGroup.1.detail.3.field=7
|
||||
statGroup.1.detail.4.name=garlic fail (hour)
|
||||
statGroup.1.detail.4.option=stat_crypto.garlic.decryptFail.60m
|
||||
statGroup.1.detail.4.field=3
|
||||
#
|
||||
statGroup.2.name=processingTime
|
||||
statGroup.2.detail.0.name=process time avg ms (minute)
|
||||
statGroup.2.detail.0.option=stat_transport.sendProcessingTime.60s
|
||||
statGroup.2.detail.0.field=0
|
||||
statGroup.2.detail.1.name=process events (minute)
|
||||
statGroup.2.detail.1.option=stat_transport.sendProcessingTime.60s
|
||||
statGroup.2.detail.1.field=7
|
||||
statGroup.2.detail.2.name=process time avg ms (hour)
|
||||
statGroup.2.detail.2.option=stat_transport.sendProcessingTime.60m
|
||||
statGroup.2.detail.2.field=0
|
||||
statGroup.2.detail.3.name=process events(hour)
|
||||
statGroup.2.detail.3.option=stat_transport.sendProcessingTime.60m
|
||||
statGroup.2.detail.3.field=7
|
||||
#
|
||||
statGroup.3.name=jobInfo
|
||||
statGroup.3.detail.0.name=job run avg ms (minute)
|
||||
statGroup.3.detail.0.option=stat_jobQueue.jobRun.60s
|
||||
statGroup.3.detail.0.field=0
|
||||
statGroup.3.detail.1.name=job lag avg ms (minute)
|
||||
statGroup.3.detail.1.option=stat_jobQueue.jobLag.60s
|
||||
statGroup.3.detail.1.field=0
|
||||
statGroup.3.detail.2.name=job count (minute)
|
||||
statGroup.3.detail.2.option=stat_jobQueue.jobRun.60s
|
||||
statGroup.3.detail.2.field=7
|
||||
statGroup.3.detail.3.name=job run avg ms (hour)
|
||||
statGroup.3.detail.3.option=stat_jobQueue.jobRun.60m
|
||||
statGroup.3.detail.3.field=0
|
||||
statGroup.3.detail.4.name=job lag avg ms (hour)
|
||||
statGroup.3.detail.4.option=stat_jobQueue.jobLag.60m
|
||||
statGroup.3.detail.4.field=0
|
||||
statGroup.3.detail.5.name=job count (hour)
|
||||
statGroup.3.detail.5.option=stat_jobQueue.jobRun.60m
|
||||
statGroup.3.detail.5.field=7
|
||||
#
|
||||
statGroup.4.name=tunnels
|
||||
statGroup.4.detail.0.name=participating tunnels count (5 minutes)
|
||||
statGroup.4.detail.0.option=stat_tunnel.participatingTunnels.5m
|
||||
statGroup.4.detail.0.field=0
|
||||
statGroup.4.detail.1.name=participating tunnels joined (5 minutes)
|
||||
statGroup.4.detail.1.option=stat_tunnel.participatingTunnels.5m
|
||||
statGroup.4.detail.1.field=3
|
||||
statGroup.4.detail.2.name=participating tunnels count (hour)
|
||||
statGroup.4.detail.2.option=stat_tunnel.participatingTunnels.60m
|
||||
statGroup.4.detail.2.field=0
|
||||
statGroup.4.detail.3.name=participating tunnels joined (hour)
|
||||
statGroup.4.detail.3.option=stat_tunnel.participatingTunnels.60m
|
||||
statGroup.4.detail.3.field=3
|
||||
statGroup.4.detail.4.name=unknown tunnels (hour)
|
||||
statGroup.4.detail.4.option=stat_tunnel.unknownTunnelTimeLeft.60m
|
||||
statGroup.4.detail.4.field=3
|
||||
statGroup.4.detail.5.name=unknown tunnel time remaining (hour)
|
||||
statGroup.4.detail.5.option=stat_tunnel.unknownTunnelTimeLeft.60m
|
||||
statGroup.4.detail.5.field=0
|
||||
statGroup.4.detail.6.name=unknown tunnels (day)
|
||||
statGroup.4.detail.6.option=stat_tunnel.unknownTunnelTimeLeft.24h
|
||||
statGroup.4.detail.6.field=3
|
||||
statGroup.4.detail.7.name=unknown tunnel time remaining (day)
|
||||
statGroup.4.detail.7.option=stat_tunnel.unknownTunnelTimeLeft.24h
|
||||
statGroup.4.detail.7.field=0
|
||||
#
|
||||
statGroup.5.name=transfer
|
||||
statGroup.5.detail.0.name=messages sent (5 minutes)
|
||||
statGroup.5.detail.0.option=stat_transport.sendMessageSize.5m
|
||||
statGroup.5.detail.0.field=7
|
||||
statGroup.5.detail.1.name=send message size avg (5 minutes)
|
||||
statGroup.5.detail.1.option=stat_transport.sendMessageSize.5m
|
||||
statGroup.5.detail.1.field=0
|
||||
statGroup.5.detail.2.name=messages sent (hour)
|
||||
statGroup.5.detail.2.option=stat_transport.sendMessageSize.60m
|
||||
statGroup.5.detail.2.field=7
|
||||
statGroup.5.detail.3.name=send message size avg (hour)
|
||||
statGroup.5.detail.3.option=stat_transport.sendMessageSize.60m
|
||||
statGroup.5.detail.3.field=0
|
||||
statGroup.5.detail.4.name=messages received (5 minutes)
|
||||
statGroup.5.detail.4.option=stat_transport.receiveMessageSize.5m
|
||||
statGroup.5.detail.4.field=7
|
||||
statGroup.5.detail.5.name=receive message size avg (5 minutes)
|
||||
statGroup.5.detail.5.option=stat_transport.receiveMessageSize.5m
|
||||
statGroup.5.detail.5.field=0
|
||||
statGroup.5.detail.6.name=messages received (hour)
|
||||
statGroup.5.detail.6.option=stat_transport.receiveMessageSize.60m
|
||||
statGroup.5.detail.6.field=7
|
||||
statGroup.5.detail.7.name=receive message size avg (hour)
|
||||
statGroup.5.detail.7.option=stat_transport.receiveMessageSize.60m
|
||||
statGroup.5.detail.7.field=0
|
||||
#
|
||||
statGroup.6.name=networkDbHandling
|
||||
statGroup.6.detail.0.name=lookups received (5 minutes)
|
||||
statGroup.6.detail.0.option=stat_netDb.lookupsReceived.5m
|
||||
statGroup.6.detail.0.field=3
|
||||
statGroup.6.detail.1.name=lookups handled (5 minutes)
|
||||
statGroup.6.detail.1.option=stat_netDb.lookupsHandled.5m
|
||||
statGroup.6.detail.1.field=3
|
||||
statGroup.6.detail.2.name=lookups matched (5 minutes)
|
||||
statGroup.6.detail.2.option=stat_netDb.lookupsReceived.5m
|
||||
statGroup.6.detail.2.field=3
|
||||
statGroup.6.detail.3.name=lookups received (hour)
|
||||
statGroup.6.detail.3.option=stat_netDb.lookupsReceived.60m
|
||||
statGroup.6.detail.3.field=3
|
||||
statGroup.6.detail.4.name=lookups handled (hour)
|
||||
statGroup.6.detail.4.option=stat_netDb.lookupsHandled.60m
|
||||
statGroup.6.detail.4.field=3
|
||||
statGroup.6.detail.5.name=lookups matched (hour)
|
||||
statGroup.6.detail.5.option=stat_netDb.lookupsReceived.60m
|
||||
statGroup.6.detail.5.field=3
|
||||
#
|
||||
statGroup.7.name=networkDbActivity
|
||||
statGroup.7.detail.0.name=lookups sent (hour)
|
||||
statGroup.7.detail.0.option=stat_netDb.successPeers.60m
|
||||
statGroup.7.detail.0.field=3
|
||||
statGroup.7.detail.1.name=lookup peers (hour)
|
||||
statGroup.7.detail.1.option=stat_netDb.successPeers.60m
|
||||
statGroup.7.detail.1.field=0
|
||||
statGroup.7.detail.2.name=db store sent (5 minutes)
|
||||
statGroup.7.detail.2.option=stat_netDb.storeSent.5m
|
||||
statGroup.7.detail.2.field=3
|
||||
statGroup.7.detail.3.name=db store sent (hour)
|
||||
statGroup.7.detail.3.option=stat_netDb.storeSent.60m
|
||||
statGroup.7.detail.3.field=3
|
36
installer/java/src/heartbeat.config
Normal file
36
installer/java/src/heartbeat.config
Normal file
@ -0,0 +1,36 @@
|
||||
# where the router is located (default is localhost)
|
||||
i2cpHost=localhost
|
||||
# I2CP port for the router (default is 7654)
|
||||
i2cpPort=7654
|
||||
# How many hops we want the router to put in our tunnels (default is 2)
|
||||
numHops=2
|
||||
# where our private destination keys are located - if this doesn't exist,
|
||||
# a new one will be created and saved there (by default, heartbeat.keys)
|
||||
privateDestinationFile=heartbeat.keys
|
||||
# where do we want to export the plain base64 of our destination?
|
||||
publicDestinationFile=heartbeat.txt
|
||||
|
||||
##
|
||||
# the following configures this client to send a heartbeat ping to the heartbeat
|
||||
# server specified (which is being run on a fairly fast and reliable router, at
|
||||
# least for the moment). If you want to run this test, uncomment the following
|
||||
# lines and run the heartbeat engine (or if the heartbeat engine is configured
|
||||
# to fire on router startup, you'll need to restart your router).
|
||||
##
|
||||
|
||||
# full destination to the peer
|
||||
peer.0.peer=8b8zBtmYGzl8pKkSJ6nYln6YEvJkKhsykwBtMaiBBizSHGsIqEG8O~oCQ62H-Yf7kw~H8292XhUOhN-hfMVPl6ulMybdV2utSPq5x2vq-1mczXWieIEBIxn3FOMguAdGb-Wu3ja2IThvwx62JgO9VSu2N5RktVkV~38XlkUmmA-f~JS5~rG~Ov-QIeFWPkyXpw-kPI2Yw6FZ5OdkXmXg0Kpb61pHXwMhAKT9YPw275Y6CvsgVKWhzHEqklwQ53jUwivn-NNXnEMWPI3jKmN3BNcJ~nGKWAHs-d5S375FDPq3pAde~-UutUWu~yEDG9xwmPyM0foS3tuUgyCkE7i4Io2VUAXAlXBKL4V7WNReHTnG2n2cC06KCebufcjUthtHzXQGi4kJBPmvKK3U7GyVDXUHeeBXKZjDcjZmOKS9Cgy2mbJ-L-ypYaUsXXWAW~2YqpMpQp22JoqNh8IIPaBmCjlw-ENfdRM0nKysWr6wULoYPaOC9Hi6GaXMPIIqMM6TAAAA
|
||||
# where we'll write out the stat data
|
||||
peer.0.statFile=heartbeatStat_30s_1kb.txt
|
||||
# how many minutes of data we'll keep (3 hours)
|
||||
peer.0.statDuration=180
|
||||
# how often we'll write out the state (every 30 seconds)
|
||||
peer.0.statFrequency=30
|
||||
# how often we'll send the peer a ping (every 30 seconds)
|
||||
peer.0.sendFrequency=30
|
||||
# how large the pings and pongs will be (1KB)
|
||||
peer.0.sendSize=1024
|
||||
# what moving averages should we keep (1, 5, 30, and 120 minutes)
|
||||
peer.0.averagePeriods=1 5 30 120
|
||||
# moo
|
||||
peer.0.comment=Test with localhost sending 1KB every 30 seconds
|
@ -88,7 +88,7 @@ qs.0045.question=<none>
|
||||
qs.0050.question=End of configuration.
|
||||
|
||||
|
||||
libs.count=9
|
||||
libs.count=13
|
||||
libs.0001.name=i2p.jar
|
||||
libs.0001.islib=true
|
||||
libs.0002.name=i2ptunnel.jar
|
||||
@ -107,3 +107,11 @@ libs.0008.name=mstreaming.jar
|
||||
libs.0008.islib=true
|
||||
libs.0009.name=sam.jar
|
||||
libs.0009.islib=true
|
||||
libs.0010.name=heartbeat.jar
|
||||
libs.0010.islib=true
|
||||
libs.0011.name=netmonitor.jar
|
||||
libs.0011.islib=true
|
||||
libs.0012.name=harvester.config
|
||||
libs.0012.islib=false
|
||||
libs.0013.name=heartbeat.config
|
||||
libs.0013.islib=false
|
@ -15,7 +15,7 @@ logger.dateFormat=HH:mm:ss.SSS
|
||||
# This is the log file name before being rotated
|
||||
# '#' is replaced with the current log number for that day
|
||||
# If # is not specified, logs are not rotated
|
||||
logger.logFileName=log-#.txt
|
||||
logger.logFileName=logs/log-#.txt
|
||||
|
||||
# Log file size:
|
||||
# Maximum size of each log file:
|
||||
|
@ -144,9 +144,38 @@ tunnels.tunnelDuration=600000
|
||||
# jobs configuration parameter is a throttle, saying that if there are more than
|
||||
# that many 'jobs' that want to run ASAP at any given time, additional jobs may
|
||||
# be summarily dropped. That will reduce your load and cause others to reduce
|
||||
# their dependence on you (further reducing your load). The default value of 20
|
||||
# their dependence on you (further reducing your load). The default value of 40
|
||||
# should be sufficient, but may be increased if desired. Less than 20 is not
|
||||
# recommended, as certain normal events can queue up 10 or so jobs at a time
|
||||
# (all of which only take a few milliseconds). Leave this alone unless you know
|
||||
# what you're doing
|
||||
router.maxWaitingJobs=20
|
||||
router.maxWaitingJobs=40
|
||||
|
||||
#
|
||||
# the remaining lines describe how you can get your router to fire up client
|
||||
# applications it is up and running, all within the router's JVM. Uncomment the
|
||||
# ones you want (revising the numbers and ports accordingly)
|
||||
|
||||
# Network monitor (harvests data from the network database and stores it under
|
||||
# monitorData/, and with the netviewer GUI you can browse through its results)
|
||||
clientApp.0.main=net.i2p.netmonitor.NetMonitor
|
||||
clientApp.0.name=NetMonitor
|
||||
clientApp.0.args=
|
||||
|
||||
# SAM bridge (a simplified socket based protocol for using I2P - listens on port 7656. see
|
||||
# the specs at http://www.i2p.net/node/view/144 for more info)
|
||||
clientApp.1.main=net.i2p.sam.SAMBridge
|
||||
clientApp.1.name=SAMBridge
|
||||
clientApp.1.args=0.0.0.0 7656 i2cp.tcp.host=localhost i2cp.tcp.port=##_router_i2cp_port##
|
||||
|
||||
# EepProxy (HTTP proxy that lets you browse both eepsites and the normal web via squid.i2p)
|
||||
clientApp.2.main=net.i2p.i2ptunnel.I2PTunnel
|
||||
clientApp.2.name=EepProxy
|
||||
clientApp.2.args=-nogui -e "config localhost ##_router_i2cp_port##" -e "httpclient 4444"
|
||||
|
||||
# Heartbeat engine (uber-simple ping/pong system, configured in heartbeat.config. By itself
|
||||
# it just writes out stat data where its told to, but there's a seperate HeartbeatMonitor
|
||||
# GUI to let you visualize things)
|
||||
#clientApp.3.main=net.i2p.heartbeat.Heartbeat
|
||||
#clientApp.3.name=Heartbeat
|
||||
#clientApp.3.args=heartbeat.config
|
@ -2,4 +2,4 @@
|
||||
title ##_scripts_winttl##
|
||||
cd ##_scripts_installdir##
|
||||
echo ##_scripts_message##
|
||||
java -DloggerFilenameOverride=logs\##_scripts_logname## -Djava.library.path=. -Dcrypto.dh.precalc.min=0 -cp lib\mstreaming.jar;lib\i2p.jar -jar lib\i2ptunnel.jar -nocli -e "config localhost ##_scripts_port##" -e "##_scripts_cmd##"
|
||||
javaw -DloggerFilenameOverride=logs\##_scripts_logname## -Djava.library.path=. -Dcrypto.dh.precalc.min=0 -cp lib\mstreaming.jar;lib\i2p.jar -jar lib\i2ptunnel.jar -nocli -e "config localhost ##_scripts_port##" -e "##_scripts_cmd##"
|
||||
|
@ -5,5 +5,5 @@ cd ##_scripts_installdir##
|
||||
REM the -XX args are workarounds for bugs in java 1.4.2's garbage collector
|
||||
REM replace java with javaw if you don't want a window to pop up
|
||||
|
||||
java -cp lib\i2p.jar;lib\router.jar -Djava.library.path=. -DloggerFilenameOverride=logs\log-router-#.txt -XX:NewSize=4M -XX:MaxNewSize=8M -XX:PermSize=8M -XX:MaxPermSize=32M net.i2p.router.Router
|
||||
pause
|
||||
javaw -cp lib\i2p.jar;lib\router.jar;lib\mstreaming.jar;lib\heartbeat.jar;lib\i2ptunnel.jar;lib\netmonitor.jar;lib\sam.jar -Djava.library.path=. -DloggerFilenameOverride=logs\log-router-#.txt -XX:NewSize=4M -XX:MaxNewSize=8M -XX:PermSize=8M -XX:MaxPermSize=32M net.i2p.router.Router
|
||||
echo Router started up, please see http://localhost:7655/
|
||||
|
@ -2,7 +2,7 @@
|
||||
cd ##_scripts_installdir##
|
||||
export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
|
||||
# the -XX args are workarounds for bugs in java 1.4.2's garbage collector
|
||||
nohup nice java -cp lib/i2p.jar:lib/router.jar -Djava.library.path=. -DloggerFilenameOverride=logs/log-router-#.txt -XX:NewSize=4M -XX:MaxNewSize=8M -XX:PermSize=8M -XX:MaxPermSize=32M net.i2p.router.Router --quiet > /dev/null &
|
||||
nohup nice java -cp lib/i2p.jar:lib/router.jar:lib/mstreaming.jar:lib/heartbeat.jar:lib/i2ptunnel.jar:lib/netmonitor.jar:lib/sam.jar -Djava.library.path=. -DloggerFilenameOverride=logs/log-router-#.txt -XX:NewSize=4M -XX:MaxNewSize=8M -XX:PermSize=8M -XX:MaxPermSize=32M net.i2p.router.Router --quiet > /dev/null &
|
||||
# Save the pid just in case we ever want to stop the router
|
||||
echo $! > router.pid
|
||||
echo I2P Router started
|
||||
|
Reference in New Issue
Block a user