forked from I2P_Developers/i2p.i2p
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 abstract boolean confirmOption(String question, boolean defaultYes);
|
||||||
|
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
Install install = new CliInstall();
|
Install install = new CliInstall();
|
||||||
install.runInstall();
|
install.runInstall();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Install() {
|
public Install() {
|
||||||
_inTCP = -2;
|
_inTCP = -2;
|
||||||
_i2cpPort = -2;
|
_i2cpPort = -2;
|
||||||
_phttpRegister = null;
|
_phttpRegister = null;
|
||||||
_phttpSend = null;
|
_phttpSend = null;
|
||||||
_inBPS = -2;
|
_inBPS = -2;
|
||||||
_outBPS = -2;
|
_outBPS = -2;
|
||||||
_externalAddressIsReachable = false;
|
_externalAddressIsReachable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runInstall() {
|
public void runInstall() {
|
||||||
askQuestions();
|
askQuestions();
|
||||||
detectOS();
|
detectOS();
|
||||||
configureAll();
|
configureAll();
|
||||||
createConfigFile();
|
createConfigFile();
|
||||||
createLoggerConfig();
|
createLoggerConfig();
|
||||||
createStartScript();
|
createStartScript();
|
||||||
createReseedScript();
|
createReseedScript();
|
||||||
createEepProxyScript();
|
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("startSquid.sh", "startSquid.bat", 5555, "squid.i2p", "log-squid-#.txt", "Squid Proxy", "Squid proxying scripts written to startSquid");
|
//createScripts("startI2PCVSProxy.sh", "startI2PCVSProxy.bat", 2401, "i2pcvs.i2p", "log-i2pcvs-#.txt", "CVS Proxy", "Proxying scripts for I2P's CVS server written to startCVSProxy");
|
||||||
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)");
|
// only pulling them temporarily, duck, until the network is
|
||||||
//createScripts("startI2PCVSProxy.sh", "startI2PCVSProxy.bat", 2401, "i2pcvs.i2p", "log-i2pcvs-#.txt", "CVS Proxy", "Proxying scripts for I2P's CVS server written to startCVSProxy");
|
// reliable enough
|
||||||
// only pulling them temporarily, duck, until the network is
|
//createScripts("startJabber.sh", "startJabber.bat", 5222, "jabber.duck.i2p", "log-jabber-#.txt", "Jabber Proxy", "Squid proxying scripts written to startSquid");
|
||||||
// reliable enough
|
//createScripts("startNntpProxy.sh", "startNntpProxy.bat", 1119, "nntp.duck.i2p", "log-nntp-#.txt", "NNTP Proxy","NNTP proxying scripts written to startNntpProxy");
|
||||||
//createScripts("startJabber.sh", "startJabber.bat", 5222, "jabber.duck.i2p", "log-jabber-#.txt", "Jabber Proxy", "Squid proxying scripts written to startSquid");
|
createSeedNodes();
|
||||||
|
copyLibraries();
|
||||||
//createScripts("startNntpProxy.sh", "startNntpProxy.bat", 1119, "nntp.duck.i2p", "log-nntp-#.txt", "NNTP Proxy","NNTP proxying scripts written to startNntpProxy");
|
if (_isWindows) {
|
||||||
createSeedNodes();
|
showStatus("To run the router, please run startRouter.bat in " + _installDir.getAbsolutePath());
|
||||||
copyLibraries();
|
} else {
|
||||||
if (_isWindows) {
|
showStatus("To run the router, please run startRouter.sh in " + _installDir.getAbsolutePath());
|
||||||
showStatus("To run the router, please run startRouter.bat in " + _installDir.getAbsolutePath());
|
}
|
||||||
} else {
|
showStatus("");
|
||||||
showStatus("To run the router, please run startRouter.sh in " + _installDir.getAbsolutePath());
|
|
||||||
}
|
|
||||||
showStatus("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String numberTo4Digits(int number) {
|
private String numberTo4Digits(int number) {
|
||||||
String res = "0000"+number; // use four digit indices
|
String res = "0000"+number; // use four digit indices
|
||||||
return res.substring(res.length()-4);
|
return res.substring(res.length()-4);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void askQuestions() {
|
private void askQuestions() {
|
||||||
try {
|
try {
|
||||||
InputStream in =
|
InputStream in = Install.class.getResourceAsStream("/install.config");
|
||||||
Install.class.getResourceAsStream("/install.config");
|
_p = new Properties();
|
||||||
_p = new Properties();
|
_p.load(in);
|
||||||
_p.load(in);
|
in.close();
|
||||||
in.close();
|
} catch (IOException ex) {
|
||||||
} catch (IOException ex) {
|
ex.printStackTrace();
|
||||||
ex.printStackTrace();
|
System.exit(1);
|
||||||
System.exit(1);
|
}
|
||||||
}
|
int count = Integer.parseInt(_p.getProperty("qs.count"));
|
||||||
int count = Integer.parseInt(_p.getProperty("qs.count"));
|
_answers = new HashMap(count+count); // load factor is 0.75, so
|
||||||
_answers = new HashMap(count+count); // load factor is 0.75, so
|
// there is some room left
|
||||||
// there is some room left
|
for (int i=1;i<=count;i++) {
|
||||||
for (int i=1;i<=count;i++) {
|
String ii = numberTo4Digits(i);
|
||||||
String ii = numberTo4Digits(i);
|
String question = _p.getProperty("qs."+ii+".question"),
|
||||||
String question = _p.getProperty("qs."+ii+".question"),
|
param = _p.getProperty("qs."+ii+".param"),
|
||||||
param = _p.getProperty("qs."+ii+".param"),
|
type = _p.getProperty("qs."+ii+".type"),
|
||||||
type = _p.getProperty("qs."+ii+".type"),
|
def = _p.getProperty("qs."+ii+".default");
|
||||||
def = _p.getProperty("qs."+ii+".default");
|
if (question == null) continue;
|
||||||
if (question == null) continue;
|
if (type == null || "info".equals(type)) {
|
||||||
if (type == null || "info".equals(type)) {
|
// just print some text
|
||||||
// just print some text
|
handleOptInfo(question);
|
||||||
handleOptInfo(question);
|
} else if ("info_spliced".equals(type)) {
|
||||||
} else if ("info_spliced".equals(type)) {
|
// splice in some params already queried
|
||||||
// splice in some params already queried
|
handleOptInfo(handleSpliceParams(question));
|
||||||
handleOptInfo(handleSpliceParams(question));
|
} else if ("category".equals(type)) {
|
||||||
} else if ("category".equals(type)) {
|
startOptCategory(question);
|
||||||
startOptCategory(question);
|
} else if ("skip".equals(type)) {
|
||||||
} else if ("skip".equals(type)) {
|
i = Integer.parseInt(question)-1;
|
||||||
i = Integer.parseInt(question)-1;
|
} else { // a real question
|
||||||
} else { // a real question
|
if ("<none>".equals(question)) {
|
||||||
if ("<none>".equals(question)) {
|
if (!setOption(i, def))
|
||||||
if (!setOption(i, def))
|
throw new RuntimeException("Fixed and invalid value");
|
||||||
throw new RuntimeException("Fixed and invalid value");
|
} else {
|
||||||
} else {
|
handleOption(i,question,def,type);
|
||||||
handleOption(i,question,def,type);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
finishOptions();
|
||||||
finishOptions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public /* overridable */ String handleSpliceParams(String s) {
|
public /* overridable */ String handleSpliceParams(String s) {
|
||||||
return spliceParams(s);
|
return spliceParams(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setOption(int number, String answer) {
|
public boolean setOption(int number, String answer) {
|
||||||
String ii = numberTo4Digits(number);
|
String ii = numberTo4Digits(number);
|
||||||
String param = _p.getProperty("qs."+ii+".param"),
|
String param = _p.getProperty("qs."+ii+".param"),
|
||||||
type = _p.getProperty("qs."+ii+".type");
|
type = _p.getProperty("qs."+ii+".type");
|
||||||
Object value = getOptionValue(answer, type);
|
Object value = getOptionValue(answer, type);
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (param == null || value == null)
|
if (param == null || value == null)
|
||||||
throw new NullPointerException();
|
throw new NullPointerException();
|
||||||
_answers.put(param,value);
|
_answers.put(param,value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object getOptionValue(String answer, String type) {
|
private Object getOptionValue(String answer, String type) {
|
||||||
if ("string".equals(type)) {
|
if ("string".equals(type)) {
|
||||||
// everything's okay till the very end
|
// everything's okay till the very end
|
||||||
return answer;
|
return answer;
|
||||||
} else if ("string>0".equals(type)) {
|
} else if ("string>0".equals(type)) {
|
||||||
if (answer.length() > 0) {
|
if (answer.length() > 0) {
|
||||||
return answer;
|
return answer;
|
||||||
} else {
|
} else {
|
||||||
showOptError("Empty answers are not allowed.");
|
showOptError("Empty answers are not allowed.");
|
||||||
}
|
}
|
||||||
} else if ("directory".equals(type)) {
|
} else if ("directory".equals(type)) {
|
||||||
File f = new File(answer);
|
File f = new File(answer);
|
||||||
if (f.exists()) {
|
if (f.exists()) {
|
||||||
if (f.isDirectory()) {
|
if (f.isDirectory()) {
|
||||||
showOptError("Using existing target directory " + f.getAbsolutePath());
|
showOptError("Using existing target directory " + f.getAbsolutePath());
|
||||||
return f;
|
return f;
|
||||||
} else {
|
} else {
|
||||||
showOptError("Location " + f.getAbsolutePath()+
|
showOptError("Location " + f.getAbsolutePath()+
|
||||||
" is not a directory. "+
|
" is not a directory. "+
|
||||||
"Lets try again");
|
"Lets try again");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
boolean create = confirmOption
|
boolean create = confirmOption("Target directory " + f.getAbsolutePath() +
|
||||||
("Target directory " + f.getAbsolutePath() +
|
" does not exist - create? ", false);
|
||||||
" does not exist - create? ", false);
|
if (!create) {
|
||||||
if (!create) {
|
showOptError("Lets try that again");
|
||||||
showOptError("Lets try that again");
|
} else {
|
||||||
} else {
|
boolean created = f.mkdirs();
|
||||||
boolean created = f.mkdirs();
|
if (created) {
|
||||||
if (created) {
|
showOptError("Target directory " + f.getAbsolutePath() +
|
||||||
showOptError("Target directory " +
|
" created");
|
||||||
f.getAbsolutePath() +
|
return f;
|
||||||
" created");
|
} else {
|
||||||
return f;
|
showOptError("Failed to create the "+
|
||||||
} else {
|
"directory. Lets choose another.");
|
||||||
showOptError("Failed to create the "+
|
}
|
||||||
"directory. Lets choose "+
|
}
|
||||||
"another.");
|
}
|
||||||
}
|
} else if ("boolean".equals(type)) {
|
||||||
}
|
answer=answer.toLowerCase();
|
||||||
}
|
if ("yes".equals(answer) || "y".equals(answer))
|
||||||
} else if ("boolean".equals(type)) {
|
answer="true";
|
||||||
answer=answer.toLowerCase();
|
if ("no".equals(answer) || "n".equals(answer))
|
||||||
if ("yes".equals(answer) || "y".equals(answer))
|
answer="false";
|
||||||
answer="true";
|
if ("true".equals(answer) || "false".equals(answer)) {
|
||||||
if ("no".equals(answer) || "n".equals(answer))
|
return new Boolean("true".equals(answer));
|
||||||
answer="false";
|
}
|
||||||
if ("true".equals(answer) || "false".equals(answer)) {
|
showOptError("Incorrect boolean value, try `yes' <20>r `no'");
|
||||||
return new Boolean("true".equals(answer));
|
} else if ("numeric".equals(type) || "port".equals(type)) {
|
||||||
}
|
try {
|
||||||
showOptError("Incorrect boolean value, try `yes' <20>r `no'");
|
int num = Integer.parseInt(answer);
|
||||||
} else if ("numeric".equals(type) || "port".equals(type)) {
|
if ("numeric".equals(type) ||
|
||||||
try {
|
(num >0 && num < 65536)) {
|
||||||
int num = Integer.parseInt(answer);
|
return new Integer(num);
|
||||||
if ("numeric".equals(type) ||
|
}
|
||||||
(num >0 && num < 65536)) {
|
showOptError("Port number must be from 1 to 65535");
|
||||||
return new Integer(num);
|
} catch (NumberFormatException ex) {
|
||||||
}
|
showOptError("Incorrect value: "+ex.getMessage());
|
||||||
showOptError("Port number must be from 1 to 65535");
|
}
|
||||||
} catch (NumberFormatException ex) {
|
} else if ("bandwidth".equals(type)) {
|
||||||
showOptError("Incorrect value: "+ex.getMessage());
|
try {
|
||||||
}
|
answer = answer.toLowerCase();
|
||||||
} else if ("bandwidth".equals(type)) {
|
int factor = 1;
|
||||||
try {
|
// first check to see if it ends with m, k, or g
|
||||||
answer = answer.toLowerCase();
|
if (answer.endsWith("g"))
|
||||||
int factor = 1;
|
factor = 1024*1024*1024;
|
||||||
// first check to see if it ends with m, k, or g
|
if (answer.endsWith("m"))
|
||||||
if (answer.endsWith("g"))
|
factor = 1024*1024;
|
||||||
factor = 1024*1024*1024;
|
if (answer.endsWith("k"))
|
||||||
if (answer.endsWith("m"))
|
factor = 1024;
|
||||||
factor = 1024*1024;
|
if (factor > 1)
|
||||||
if (answer.endsWith("k"))
|
answer = answer.substring(0, answer.length()-1);
|
||||||
factor = 1024;
|
int val = factor * Integer.parseInt(answer);
|
||||||
if (factor > 1)
|
if (val == -1 || val >0 ) {
|
||||||
answer = answer.substring(0, answer.length()-1);
|
return new Integer(val);
|
||||||
int val = factor * Integer.parseInt(answer);
|
}
|
||||||
if (val == -1 || val >0 ) {
|
showOptError("Value must be -1 or positive.");
|
||||||
return new Integer(val);
|
} catch (NumberFormatException ex) {
|
||||||
}
|
showOptError("Invalid number [" + answer + "]. Valid numbers are of the form -1, 42, 68k, 7m, 9g");
|
||||||
showOptError("Value must be -1 or positive.");
|
}
|
||||||
} catch (NumberFormatException ex) {
|
} else {
|
||||||
showOptError("Invalid number [" + answer + "]. Valid numbers are of the form -1, 42, 68k, 7m, 9g");
|
throw new RuntimeException ("cannot read installer option: " + type);
|
||||||
}
|
}
|
||||||
} else {
|
return null;
|
||||||
throw new RuntimeException ("cannot read installer option: " + type);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String spliceParams(String s) {
|
private String spliceParams(String s) {
|
||||||
StringBuffer txt = new StringBuffer(s.length()+100);
|
StringBuffer txt = new StringBuffer(s.length()+100);
|
||||||
int ind;
|
int ind;
|
||||||
while((ind = s.indexOf("##")) != -1) {
|
while((ind = s.indexOf("##")) != -1) {
|
||||||
txt.append(s.substring(0,ind));
|
txt.append(s.substring(0,ind));
|
||||||
String temp = s.substring(ind+2);
|
String temp = s.substring(ind+2);
|
||||||
ind = temp.indexOf("##");
|
ind = temp.indexOf("##");
|
||||||
if (ind == -1) throw new RuntimeException
|
if (ind == -1) throw new RuntimeException("Incorrect info_spliced param");
|
||||||
("Incorrect info_spliced param");
|
s=temp.substring(ind+2);
|
||||||
s=temp.substring(ind+2);
|
Object value = _answers.get(temp.substring(0,ind));
|
||||||
Object value = _answers.get(temp.substring(0,ind));
|
if (value == null) {
|
||||||
if (value == null) {
|
System.err.println("ERROR: Could not insert parameter "+temp.substring(0,ind));
|
||||||
System.err.println("ERROR: Could not insert parameter "+temp.substring(0,ind));
|
System.exit(1);
|
||||||
System.exit(1);
|
} else {
|
||||||
} else {
|
txt.append(value.toString());
|
||||||
txt.append(value.toString());
|
}
|
||||||
}
|
}
|
||||||
}
|
txt.append(s);
|
||||||
txt.append(s);
|
return txt.toString();
|
||||||
return txt.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void detectOS() {
|
private void detectOS() {
|
||||||
String os = System.getProperty("os.name");
|
String os = System.getProperty("os.name");
|
||||||
if (os.toLowerCase().indexOf("win") != -1)
|
if (os.toLowerCase().indexOf("win") != -1)
|
||||||
_isWindows = true;
|
_isWindows = true;
|
||||||
else
|
else
|
||||||
_isWindows = false;
|
_isWindows = false;
|
||||||
// yes, this treats pre-os-x macs as unix, and perhaps some
|
// yes, this treats pre-os-x macs as unix, and perhaps some
|
||||||
// windows-esque OSes don't have "win" in their name, or some
|
// windows-esque OSes don't have "win" in their name, or some
|
||||||
// unix-esque OS does. fix when it occurs.
|
// unix-esque OS does. fix when it occurs.
|
||||||
}
|
}
|
||||||
|
|
||||||
private void configureAll() {
|
private void configureAll() {
|
||||||
_installDir = (File) _answers.get("installDir");
|
_installDir = (File) _answers.get("installDir");
|
||||||
_externalAddress = _answers.get("externalAddress").toString();
|
_externalAddress = _answers.get("externalAddress").toString();
|
||||||
_externalAddressIsReachable = ((Boolean)_answers.get("externalAddressIsReachable")).booleanValue();
|
_externalAddressIsReachable = ((Boolean)_answers.get("externalAddressIsReachable")).booleanValue();
|
||||||
|
|
||||||
_inTCP=((Integer)_answers.get("inTCP")).intValue();
|
_inTCP=((Integer)_answers.get("inTCP")).intValue();
|
||||||
_phttpRegister = _answers.get("phttpRegister").toString();
|
_phttpRegister = _answers.get("phttpRegister").toString();
|
||||||
_phttpSend = _answers.get("phttpSend").toString();
|
_phttpSend = _answers.get("phttpSend").toString();
|
||||||
_i2cpPort = ((Integer)_answers.get("i2cpPort")).intValue();
|
_i2cpPort = ((Integer)_answers.get("i2cpPort")).intValue();
|
||||||
_inBPS = ((Integer)_answers.get("inBPS")).intValue();
|
_inBPS = ((Integer)_answers.get("inBPS")).intValue();
|
||||||
_outBPS = ((Integer)_answers.get("outBPS")).intValue();
|
_outBPS = ((Integer)_answers.get("outBPS")).intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void useTemplate(String templateName, File destFile) {
|
private void useTemplate(String templateName, File destFile) {
|
||||||
try {
|
try {
|
||||||
BufferedWriter bw = new BufferedWriter(new FileWriter(destFile));
|
BufferedWriter bw = new BufferedWriter(new FileWriter(destFile));
|
||||||
BufferedReader br = new BufferedReader
|
BufferedReader br = new BufferedReader(new InputStreamReader(Install.class.getResourceAsStream(templateName)));
|
||||||
(new InputStreamReader
|
String line;
|
||||||
(Install.class.getResourceAsStream(templateName)));
|
while ((line = br.readLine()) != null) {
|
||||||
String line;
|
if (!line.startsWith("####")) {
|
||||||
while ((line = br.readLine()) != null) {
|
bw.write(spliceParams(line));
|
||||||
if (!line.startsWith("####")) {
|
bw.newLine();
|
||||||
bw.write(spliceParams(line));
|
}
|
||||||
bw.newLine();
|
}
|
||||||
}
|
br.close();
|
||||||
}
|
bw.close();
|
||||||
br.close();
|
} catch (IOException ioe) {
|
||||||
bw.close();
|
ioe.printStackTrace();
|
||||||
} catch (IOException ioe) {
|
System.exit(0);
|
||||||
ioe.printStackTrace();
|
}
|
||||||
System.exit(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createLoggerConfig() {
|
private void createLoggerConfig() {
|
||||||
@ -364,249 +354,243 @@ public abstract class Install {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createSeedNodes() {
|
private void createSeedNodes() {
|
||||||
showStatus("To connect to I2P, you will need a reference to at least one other I2P 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("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("you can either run the included reseed script or get get your own references ");
|
||||||
showStatus("from some out of band location. ");
|
showStatus("from some out of band location. ");
|
||||||
showStatus("");
|
showStatus("");
|
||||||
showStatus("The reseed script simply connects to http://i2p.net/i2pdb/ and downloads all");
|
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("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("That ../i2pdb/ directory is simply a mirror of one router's netDb directory, so those files");
|
||||||
showStatus("can come from anyone else too");
|
showStatus("can come from anyone else too");
|
||||||
showStatus("");
|
showStatus("");
|
||||||
showStatus("You can run the reseed script or download references (from your friends, etc) as often");
|
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("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("only one file in it (thats your router info), you will need more peers to get anything done.");
|
||||||
showStatus("");
|
showStatus("");
|
||||||
boolean reseed = confirmOption("Do you want to run the reseed script now? ", true);
|
boolean reseed = confirmOption("Do you want to run the reseed script now? ", true);
|
||||||
if (reseed) {
|
if (reseed) {
|
||||||
reseed();
|
reseed();
|
||||||
} else {
|
} else {
|
||||||
showStatus("Ok ok, not reseeding - but please reseed before running the router");
|
showStatus("Ok ok, not reseeding - but please reseed before running the router");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reseed() {
|
private void reseed() {
|
||||||
try {
|
try {
|
||||||
URL dir = new URL("http://i2p.net/i2pdb/");
|
URL dir = new URL("http://i2p.net/i2pdb/");
|
||||||
String content = new String(readURL(dir));
|
String content = new String(readURL(dir));
|
||||||
Set urls = new HashSet();
|
Set urls = new HashSet();
|
||||||
int cur = 0;
|
int cur = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
int start = content.indexOf("href=\"routerInfo-", cur);
|
int start = content.indexOf("href=\"routerInfo-", cur);
|
||||||
if (start < 0)
|
if (start < 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
int end = content.indexOf(".dat\">", start);
|
int end = content.indexOf(".dat\">", start);
|
||||||
String name = content.substring(start+"href=\"routerInfo-".length(), end);
|
String name = content.substring(start+"href=\"routerInfo-".length(), end);
|
||||||
urls.add(name);
|
urls.add(name);
|
||||||
cur = end + 1;
|
cur = end + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Iterator iter = urls.iterator(); iter.hasNext(); ) {
|
for (Iterator iter = urls.iterator(); iter.hasNext(); ) {
|
||||||
fetchSeed((String)iter.next());
|
fetchSeed((String)iter.next());
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
showStatus("Error reseeding - " + t.getMessage());
|
showStatus("Error reseeding - " + t.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fetchSeed(String peer) throws Exception {
|
private void fetchSeed(String peer) throws Exception {
|
||||||
URL url = new URL("http://i2p.net/i2pdb/routerInfo-" + peer + ".dat");
|
URL url = new URL("http://i2p.net/i2pdb/routerInfo-" + peer + ".dat");
|
||||||
showStatus("Fetching seed from " + url.toExternalForm());
|
showStatus("Fetching seed from " + url.toExternalForm());
|
||||||
|
|
||||||
byte data[] = readURL(url);
|
byte data[] = readURL(url);
|
||||||
writeSeed(peer, data);
|
writeSeed(peer, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] readURL(URL url) throws Exception {
|
private byte[] readURL(URL url) throws Exception {
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
|
ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
|
||||||
URLConnection con = url.openConnection();
|
URLConnection con = url.openConnection();
|
||||||
InputStream in = con.getInputStream();
|
InputStream in = con.getInputStream();
|
||||||
byte buf[] = new byte[1024];
|
byte buf[] = new byte[1024];
|
||||||
while (true) {
|
while (true) {
|
||||||
int read = in.read(buf);
|
int read = in.read(buf);
|
||||||
if (read < 0)
|
if (read < 0)
|
||||||
break;
|
break;
|
||||||
baos.write(buf, 0, read);
|
baos.write(buf, 0, read);
|
||||||
}
|
}
|
||||||
in.close();
|
in.close();
|
||||||
return baos.toByteArray();
|
return baos.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeSeed(String name, byte data[]) throws Exception {
|
private void writeSeed(String name, byte data[]) throws Exception {
|
||||||
File netDbDir = new File(_installDir, "netDb");
|
File netDbDir = new File(_installDir, "netDb");
|
||||||
if (!netDbDir.exists())
|
if (!netDbDir.exists())
|
||||||
netDbDir.mkdirs();
|
netDbDir.mkdirs();
|
||||||
FileOutputStream fos = new FileOutputStream(new File(netDbDir, "routerInfo-" + name + ".dat"));
|
FileOutputStream fos = new FileOutputStream(new File(netDbDir, "routerInfo-" + name + ".dat"));
|
||||||
fos.write(data);
|
fos.write(data);
|
||||||
fos.close();
|
fos.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void copyLibraries() {
|
private void copyLibraries() {
|
||||||
File libDir = new File(_installDir, "lib");
|
File libDir = new File(_installDir, "lib");
|
||||||
if (!libDir.exists()) {
|
if (!libDir.exists()) {
|
||||||
boolean libCreated = libDir.mkdirs();
|
boolean libCreated = libDir.mkdirs();
|
||||||
if (!libCreated) {
|
if (!libCreated) {
|
||||||
showStatus("Error creating library directory " + libDir.getAbsolutePath());
|
showStatus("Error creating library directory " + libDir.getAbsolutePath());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
showStatus("Installing the libraries into " + libDir.getAbsolutePath());
|
showStatus("Installing the libraries into " + libDir.getAbsolutePath());
|
||||||
int cnt = Integer.parseInt(_p.getProperty("libs.count"));
|
int cnt = Integer.parseInt(_p.getProperty("libs.count"));
|
||||||
try {
|
try {
|
||||||
for (int i=1;i<=cnt;i++) {
|
for (int i=1;i<=cnt;i++) {
|
||||||
String ii = numberTo4Digits(i),
|
String ii = numberTo4Digits(i),
|
||||||
file = _p.getProperty("libs."+ii+".name");
|
file = _p.getProperty("libs."+ii+".name");
|
||||||
boolean isLib = "true".equals(_p.getProperty("libs."+ii+".islib"));
|
boolean isLib = "true".equals(_p.getProperty("libs."+ii+".islib"));
|
||||||
InputStream is = Install.class.getResourceAsStream("/"+file);
|
InputStream is = Install.class.getResourceAsStream("/"+file);
|
||||||
if (is == null) throw new IOException("Resource /"+file+" not found");
|
if (is == null) throw new IOException("Resource /"+file+" not found");
|
||||||
copyFile(is, file, isLib?libDir:_installDir);
|
copyFile(is, file, isLib?libDir:_installDir);
|
||||||
}
|
}
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
showStatus("Error extracting the libraries: " + ioe.getMessage());
|
showStatus("Error extracting the libraries: " + ioe.getMessage());
|
||||||
}
|
}
|
||||||
File dbDir = new File(_installDir, "netDb");
|
File dbDir = new File(_installDir, "netDb");
|
||||||
dbDir.mkdirs();
|
dbDir.mkdirs();
|
||||||
File logDir = new File(_installDir, "logs");
|
File logDir = new File(_installDir, "logs");
|
||||||
logDir.mkdirs();
|
logDir.mkdirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void copyFile(InputStream in, String name, File destDir) {
|
private void copyFile(InputStream in, String name, File destDir) {
|
||||||
File destFile = new File(destDir, name);
|
File destFile = new File(destDir, name);
|
||||||
try {
|
try {
|
||||||
byte buf[] = new byte[16*1024];
|
byte buf[] = new byte[16*1024];
|
||||||
FileOutputStream out = new FileOutputStream(destFile);
|
FileOutputStream out = new FileOutputStream(destFile);
|
||||||
while (true) {
|
while (true) {
|
||||||
int read = in.read(buf);
|
int read = in.read(buf);
|
||||||
if (read == -1)
|
if (read == -1)
|
||||||
break;
|
break;
|
||||||
out.write(buf, 0, read);
|
out.write(buf, 0, read);
|
||||||
}
|
}
|
||||||
in.close();
|
in.close();
|
||||||
out.close();
|
out.close();
|
||||||
showStatus("Installed file " + destFile.getName() + " in " + destFile.getParent());
|
showStatus("Installed file " + destFile.getName() + " in " + destFile.getParent());
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
showStatus("Error saving " + name + " to " + destFile.getAbsolutePath() + ": " + ioe.getMessage());
|
showStatus("Error saving " + name + " to " + destFile.getAbsolutePath()
|
||||||
}
|
+ ": " + ioe.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createLogConfigOptions(boolean verbose) {
|
private void createLogConfigOptions(boolean verbose) {
|
||||||
_answers.put("_logger_level", verbose?"DEBUG":"INFO");
|
_answers.put("_logger_level", verbose?"DEBUG":"INFO");
|
||||||
_answers.put("_logger_level2", verbose?"WARN":"ERROR");
|
_answers.put("_logger_level2", verbose?"WARN":"ERROR");
|
||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
if (!verbose) {
|
if (!verbose) {
|
||||||
// overrides for particularly chatty classes
|
// overrides for particularly chatty classes
|
||||||
_answers.put("_logger_notverbose",
|
_answers.put("_logger_notverbose", "logger.record.net.i2p.router.transport.Triv=ERROR"+NL+
|
||||||
"logger.record.net.i2p.router.transport.Triv=ERROR"+NL+
|
"logger.record.net.i2p.router.transport.Band=ERROR"+NL+
|
||||||
"logger.record.net.i2p.router.transport.Band=ERROR"+NL+
|
"logger.record.net.i2p.crypto=ERROR" +NL+
|
||||||
"logger.record.net.i2p.crypto=ERROR" +NL+
|
"logger.record.net.i2p.crypto.DH=ERROR");
|
||||||
"logger.record.net.i2p.crypto.DH=ERROR");
|
} else {
|
||||||
} else {
|
_answers.put("_logger_notverbose","");
|
||||||
_answers.put("_logger_notverbose","");
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createScripts(String unixName, String windowsName, int listenPort, String targetDest, String logfilePattern, String windowTitle, String message, String scriptMessage) {
|
private void createScripts(String unixName, String windowsName, int listenPort,
|
||||||
createScripts(unixName, windowsName, "client "+listenPort+" "+targetDest, logfilePattern, windowTitle, message, scriptMessage);
|
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) {
|
private void createScripts(String unixName, String windowsName, String command,
|
||||||
_answers.put("_scripts_port", ""+_i2cpPort);
|
String logfilePattern, String windowTitle, String message,
|
||||||
_answers.put("_scripts_cmd", command);
|
String scriptMessage) {
|
||||||
_answers.put("_scripts_logname", logfilePattern);
|
_answers.put("_scripts_port", ""+_i2cpPort);
|
||||||
_answers.put("_scripts_winttl", windowTitle);
|
_answers.put("_scripts_cmd", command);
|
||||||
_answers.put("_scripts_message", scriptMessage);
|
_answers.put("_scripts_logname", logfilePattern);
|
||||||
if (_isWindows) {
|
_answers.put("_scripts_winttl", windowTitle);
|
||||||
File windowsFile = new File(_installDir, windowsName);
|
_answers.put("_scripts_message", scriptMessage);
|
||||||
useTemplate("startFoo.bat.template", windowsFile);
|
if (_isWindows) {
|
||||||
} else {
|
File windowsFile = new File(_installDir, windowsName);
|
||||||
File unixFile = new File(_installDir, unixName);
|
useTemplate("startFoo.bat.template", windowsFile);
|
||||||
useTemplate("startFoo.sh.template", unixFile);
|
} else {
|
||||||
chmodaplusx(unixFile);
|
File unixFile = new File(_installDir, unixName);
|
||||||
}
|
useTemplate("startFoo.sh.template", unixFile);
|
||||||
showStatus(message);
|
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 createReseedScript() {
|
private void createReseedScript() {
|
||||||
if (_isWindows) {
|
if (_isWindows) {
|
||||||
File windowsFile = new File(_installDir, "reseed.bat");
|
File windowsFile = new File(_installDir, "reseed.bat");
|
||||||
useTemplate("reseed.bat.template", windowsFile);
|
useTemplate("reseed.bat.template", windowsFile);
|
||||||
} else {
|
} else {
|
||||||
File unixFile = new File(_installDir, "reseed.sh");
|
File unixFile = new File(_installDir, "reseed.sh");
|
||||||
useTemplate("reseed.sh.template", unixFile);
|
useTemplate("reseed.sh.template", unixFile);
|
||||||
chmodaplusx(unixFile);
|
chmodaplusx(unixFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void chmodaplusx(File f) {
|
private void chmodaplusx(File f) {
|
||||||
try {
|
try {
|
||||||
Runtime.getRuntime().exec("chmod a+x " + f.getAbsolutePath());
|
Runtime.getRuntime().exec("chmod a+x " + f.getAbsolutePath());
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
showStatus("Error setting "+f.getName()+" as executable");
|
showStatus("Error setting "+f.getName()+" as executable");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createStartScript() {
|
private void createStartScript() {
|
||||||
_answers.put("_scripts_installdir", _installDir.getAbsolutePath());
|
_answers.put("_scripts_installdir", _installDir.getAbsolutePath());
|
||||||
if (_isWindows) {
|
if (_isWindows) {
|
||||||
File windowsFile = new File(_installDir, "startRouter.bat");
|
File windowsFile = new File(_installDir, "startRouter.bat");
|
||||||
useTemplate("startRouter.bat.template", windowsFile);
|
useTemplate("startRouter.bat.template", windowsFile);
|
||||||
} else {
|
} else {
|
||||||
File unixFile = new File(_installDir, "startRouter.sh");
|
File unixFile = new File(_installDir, "startRouter.sh");
|
||||||
useTemplate("startRouter.sh.template", unixFile);
|
useTemplate("startRouter.sh.template", unixFile);
|
||||||
File unixStopFile = new File(_installDir, "stopRouter.sh");
|
File unixStopFile = new File(_installDir, "stopRouter.sh");
|
||||||
useTemplate("stopRouter.sh.template", unixStopFile);
|
useTemplate("stopRouter.sh.template", unixStopFile);
|
||||||
chmodaplusx(unixFile);
|
chmodaplusx(unixFile);
|
||||||
chmodaplusx(unixStopFile);
|
chmodaplusx(unixStopFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createConfigFile() {
|
private void createConfigFile() {
|
||||||
File configFile = new File(_installDir, "router.config");
|
File configFile = new File(_installDir, "router.config");
|
||||||
setConfigFileOptions();
|
setConfigFileOptions();
|
||||||
useTemplate("router.config.template", configFile);
|
useTemplate("router.config.template", configFile);
|
||||||
showStatus("Router configuration file written to " + configFile.getAbsolutePath());
|
showStatus("Router configuration file written to " + configFile.getAbsolutePath());
|
||||||
showStatus("");
|
showStatus("");
|
||||||
}
|
}
|
||||||
|
|
||||||
private final static String NL = System.getProperty("line.separator");
|
private final static String NL = System.getProperty("line.separator");
|
||||||
|
|
||||||
private void setConfigFileOptions() {
|
private void setConfigFileOptions() {
|
||||||
// set fields needed for the config template
|
// set fields needed for the config template
|
||||||
_answers.put("NOW", new Date().toString());
|
_answers.put("NOW", new Date().toString());
|
||||||
if (_inTCP <= 0) {
|
if (_inTCP <= 0) {
|
||||||
_answers.put("_router_hn", "#i2np.tcp.hostname=[externally reachable hostname or IP address goes here]");
|
_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_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_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)])");
|
_answers.put("_router_tcpdisable","#i2np.tcp.disable=[true/false for whether you want absolutely no tcp connections to be established (forcing phttp, etc)])");
|
||||||
} else {
|
} else {
|
||||||
_answers.put("_router_hn","i2np.tcp.hostname="+_externalAddress);
|
_answers.put("_router_hn","i2np.tcp.hostname="+_externalAddress);
|
||||||
_answers.put("_router_port","i2np.tcp.port="+_inTCP);
|
_answers.put("_router_port","i2np.tcp.port="+_inTCP);
|
||||||
_answers.put("_router_lavalid","i2np.tcp.listenAddressIsValid="+_externalAddressIsReachable);
|
_answers.put("_router_lavalid","i2np.tcp.listenAddressIsValid="+_externalAddressIsReachable);
|
||||||
_answers.put("_router_tcpdisable","i2np.tcp.disable=false");
|
_answers.put("_router_tcpdisable","i2np.tcp.disable=false");
|
||||||
}
|
}
|
||||||
if ( (_phttpRegister == null) || (_phttpSend == null) ) {
|
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_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]");
|
_answers.put("_router_phttpsend","#i2np.phttp.sendURL=[full URL to a PHTTP relay server, e.g. http://someHost:8080/phttprelay/phttpSend]");
|
||||||
} else {
|
} else {
|
||||||
_answers.put("_router_phttpreg","i2np.phttp.registerURL="+_phttpRegister);
|
_answers.put("_router_phttpreg","i2np.phttp.registerURL="+_phttpRegister);
|
||||||
_answers.put("_router_phttpsend","i2np.phttp.sendURL="+_phttpSend);
|
_answers.put("_router_phttpsend","i2np.phttp.sendURL="+_phttpSend);
|
||||||
}
|
}
|
||||||
_answers.put("_router_i2cp_port",""+_i2cpPort);
|
_answers.put("_router_i2cp_port",""+_i2cpPort);
|
||||||
_answers.put("_router_inbps",""+(_inBPS*60));
|
_answers.put("_router_inbps",""+(_inBPS*60));
|
||||||
_answers.put("_router_outbps",""+(_outBPS*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.
|
qs.0050.question=End of configuration.
|
||||||
|
|
||||||
|
|
||||||
libs.count=9
|
libs.count=13
|
||||||
libs.0001.name=i2p.jar
|
libs.0001.name=i2p.jar
|
||||||
libs.0001.islib=true
|
libs.0001.islib=true
|
||||||
libs.0002.name=i2ptunnel.jar
|
libs.0002.name=i2ptunnel.jar
|
||||||
@ -107,3 +107,11 @@ libs.0008.name=mstreaming.jar
|
|||||||
libs.0008.islib=true
|
libs.0008.islib=true
|
||||||
libs.0009.name=sam.jar
|
libs.0009.name=sam.jar
|
||||||
libs.0009.islib=true
|
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
|
# This is the log file name before being rotated
|
||||||
# '#' is replaced with the current log number for that day
|
# '#' is replaced with the current log number for that day
|
||||||
# If # is not specified, logs are not rotated
|
# If # is not specified, logs are not rotated
|
||||||
logger.logFileName=log-#.txt
|
logger.logFileName=logs/log-#.txt
|
||||||
|
|
||||||
# Log file size:
|
# Log file size:
|
||||||
# Maximum size of each log file:
|
# 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
|
# 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
|
# 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
|
# 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
|
# 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
|
# 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
|
# (all of which only take a few milliseconds). Leave this alone unless you know
|
||||||
# what you're doing
|
# 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##
|
title ##_scripts_winttl##
|
||||||
cd ##_scripts_installdir##
|
cd ##_scripts_installdir##
|
||||||
echo ##_scripts_message##
|
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 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
|
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
|
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
|
||||||
pause
|
echo Router started up, please see http://localhost:7655/
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
cd ##_scripts_installdir##
|
cd ##_scripts_installdir##
|
||||||
export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
|
export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
|
||||||
# the -XX args are workarounds for bugs in java 1.4.2's garbage collector
|
# 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
|
# Save the pid just in case we ever want to stop the router
|
||||||
echo $! > router.pid
|
echo $! > router.pid
|
||||||
echo I2P Router started
|
echo I2P Router started
|
||||||
|
Reference in New Issue
Block a user