|
|
@ -98,7 +98,7 @@ public class TunnelControl implements Runnable {
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public void save() {
|
|
|
|
public String getJSON(boolean includeKeyPairs) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
JSONObject root = new JSONObject();
|
|
|
|
JSONObject root = new JSONObject();
|
|
|
|
JSONArray tunnelsArray = new JSONArray();
|
|
|
|
JSONArray tunnelsArray = new JSONArray();
|
|
|
@ -112,7 +112,7 @@ public class TunnelControl implements Runnable {
|
|
|
|
entry.put("host", t.getHost());
|
|
|
|
entry.put("host", t.getHost());
|
|
|
|
entry.put("port", t.getPort());
|
|
|
|
entry.put("port", t.getPort());
|
|
|
|
entry.put("dest", t.getI2P());
|
|
|
|
entry.put("dest", t.getI2P());
|
|
|
|
entry.put("keypair", ((ServerTunnel) t).keyPair.toString());
|
|
|
|
if(includeKeyPairs) entry.put("keypair", ((ServerTunnel) t).keyPair.toString());
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case "client":
|
|
|
|
case "client":
|
|
|
@ -125,7 +125,15 @@ public class TunnelControl implements Runnable {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Files.writeString(new File(tunnelControlConfigDir, "tunnels.json").toPath(), root.toJSONString());
|
|
|
|
return root.toJSONString();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception e) {
|
|
|
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public void save() {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
Files.writeString(new File(tunnelControlConfigDir, "tunnels.json").toPath(), getJSON(true));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception e) {
|
|
|
|
catch (Exception e) {
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
throw new RuntimeException(e);
|
|
|
@ -389,6 +397,11 @@ public class TunnelControl implements Runnable {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case "all.list": {
|
|
|
|
|
|
|
|
out.println(tunnelList.getJSON(false));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
case "sam.create": {
|
|
|
|
case "sam.create": {
|
|
|
|
String[] samArgs = new String[]{"sam.keys", "127.0.0.1", "7656", "i2cp.tcp.host=127.0.0.1", "i2cp.tcp.port=7654"};
|
|
|
|
String[] samArgs = new String[]{"sam.keys", "127.0.0.1", "7656", "i2cp.tcp.host=127.0.0.1", "i2cp.tcp.port=7654"};
|
|
|
|
I2PAppContext context = router.getContext();
|
|
|
|
I2PAppContext context = router.getContext();
|
|
|
|