mirror of
https://github.com/wownero/i2p-zero.git
synced 2026-10-17 15:21:40 +02:00
Options can now be set on the command line
This commit is contained in:
@@ -2,6 +2,7 @@ package org.getmonero.i2p.embedded;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Properties;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.app.ClientAppManager;
|
||||
@@ -13,7 +14,8 @@ public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
System.out.println("I2P router launched. SAM listening on port 7656. Press Ctrl-C to terminate.");
|
||||
System.out.println("I2P router launched. SAM listening on port 7656.\n" +
|
||||
"Press Ctrl-C to gracefully shut down the router (or send the SIGINT signal to the process).");
|
||||
|
||||
Properties p = new Properties();
|
||||
// add your configuration settings, directories, etc.
|
||||
@@ -21,18 +23,29 @@ public class Main {
|
||||
p.put("i2p.dir.base", "/usr/share/i2p");
|
||||
// where to find the I2P data files
|
||||
p.put("i2p.dir.config", System.getProperty("user.home") + File.separator + ".i2p");
|
||||
|
||||
// bandwidth limits in K bytes per second
|
||||
p.put("i2np.inboundKBytesPerSecond","50");
|
||||
p.put("i2np.outboundKBytesPerSecond","50");
|
||||
p.put("router.sharePercentage","80");
|
||||
|
||||
// allow default properties to be overridden via command line args, e.g. --i2p.dir.base=/usr/share/i2p
|
||||
for(String arg : args) {
|
||||
if(arg.startsWith("--")) {
|
||||
String[] s = arg.split("=");
|
||||
String argName = s[0].substring("--".length());
|
||||
String argVal = s[1];
|
||||
p.put(argName, argVal);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("Options set: "
|
||||
+ p.entrySet().stream().map(e->"--"+e.getKey()+"="+e.getValue()).collect(Collectors.joining( " " )));
|
||||
|
||||
Router r = new Router(p);
|
||||
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
// don't call exit() when the router stops
|
||||
r.setKillVMOnEnd(true);
|
||||
r.runRouter();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user