mirror of
https://github.com/wownero/i2p-zero.git
synced 2026-10-18 07:41:40 +02:00
LG2=en for faster i2p-java ant build
now using i2p-java tag 0.9.38 SAM listener now only starts if requested via tunnel-control
This commit is contained in:
@@ -99,6 +99,10 @@ Call the `dist/linux/router/bin/tunnel-control.sh` script as follows to create a
|
||||
|
||||
`tunnel-control.sh socks.destroy <port>`
|
||||
|
||||
#### Start a SAM listener on port 7656. Returns "OK"
|
||||
|
||||
`tunnel-control.sh sam.create`
|
||||
|
||||
|
||||
## Watch the I2P log for messages
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ source $basedir/bin/java-config.sh
|
||||
|
||||
# build the jars we're going to modularize
|
||||
cd $basedir/import/i2p.i2p
|
||||
export LG2=en
|
||||
$basedir/import/apache-ant-1.10.5/bin/ant pkg
|
||||
$basedir/import/apache-ant-1.10.5/bin/ant updaterWithJbigi
|
||||
cd ..
|
||||
|
||||
@@ -13,7 +13,7 @@ fi
|
||||
|
||||
cd $basedir/import/i2p.i2p
|
||||
git fetch
|
||||
git checkout tags/i2p-0.9.37
|
||||
git checkout tags/i2p-0.9.38
|
||||
cd ..
|
||||
|
||||
if [ ! -d "$basedir/import/jdks" ]; then
|
||||
|
||||
@@ -4,11 +4,7 @@ import java.io.File;
|
||||
import java.util.Properties;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.app.ClientAppManager;
|
||||
import net.i2p.app.ClientAppManagerImpl;
|
||||
import net.i2p.router.Router;
|
||||
import net.i2p.sam.SAMBridge;
|
||||
|
||||
public class Main {
|
||||
|
||||
@@ -41,17 +37,17 @@ public class Main {
|
||||
System.out.println("Options set: "
|
||||
+ p.entrySet().stream().map(e->"--"+e.getKey()+"="+e.getValue()).collect(Collectors.joining(" ")));
|
||||
|
||||
Router r = new Router(p);
|
||||
Router router = new Router(p);
|
||||
|
||||
new Thread(()->{
|
||||
r.setKillVMOnEnd(true);
|
||||
r.runRouter();
|
||||
router.setKillVMOnEnd(true);
|
||||
router.runRouter();
|
||||
}).start();
|
||||
|
||||
new Thread(()->{
|
||||
try {
|
||||
while(true) {
|
||||
if(r.isAlive()) {
|
||||
if(router.isAlive()) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
@@ -60,13 +56,7 @@ public class Main {
|
||||
}
|
||||
}
|
||||
|
||||
String[] samArgs = new String[]{"sam.keys", "127.0.0.1", "7656", "i2cp.tcp.host=127.0.0.1", "i2cp.tcp.port=7654"};
|
||||
I2PAppContext context = r.getContext();
|
||||
ClientAppManager mgr = new ClientAppManagerImpl(context);
|
||||
SAMBridge samBridge = new SAMBridge(context, mgr, samArgs);
|
||||
samBridge.startup();
|
||||
|
||||
new Thread(new TunnelControl(new File(new File(p.getProperty("i2p.dir.config")), "tunnel"))).start();
|
||||
new Thread(new TunnelControl(router, new File(new File(p.getProperty("i2p.dir.config")), "tunnel"))).start();
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
@@ -76,7 +66,7 @@ public class Main {
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(()->{
|
||||
System.out.println("I2P router will shut down gracefully");
|
||||
r.shutdownGracefully();
|
||||
router.shutdownGracefully();
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
package org.getmonero.i2p.zero;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.app.ClientAppManager;
|
||||
import net.i2p.app.ClientAppManagerImpl;
|
||||
import net.i2p.data.Base64;
|
||||
import net.i2p.data.Destination;
|
||||
import net.i2p.i2ptunnel.I2PTunnel;
|
||||
import net.i2p.router.Router;
|
||||
import net.i2p.sam.SAMBridge;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
@@ -23,7 +28,9 @@ public class TunnelControl implements Runnable {
|
||||
private int clientPortSeq = 30000;
|
||||
private int serverSeq = 0;
|
||||
private String tunnelConfigDirPrefix;
|
||||
public TunnelControl(File tunnelConfigDir) {
|
||||
private Router router;
|
||||
public TunnelControl(Router router, File tunnelConfigDir) {
|
||||
this.router = router;
|
||||
tunnelConfigDir.delete();
|
||||
tunnelConfigDir.mkdir();
|
||||
this.tunnelConfigDirPrefix = tunnelConfigDir.getAbsolutePath() + File.separator;
|
||||
@@ -50,6 +57,7 @@ public class TunnelControl implements Runnable {
|
||||
var in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
|
||||
|
||||
var args = in.readLine().split(" ");
|
||||
|
||||
if(args[0].equals("server.create")) {
|
||||
String destHost = args[1];
|
||||
String destPort = args[2];
|
||||
@@ -88,7 +96,7 @@ public class TunnelControl implements Runnable {
|
||||
}).start();
|
||||
out.println(port);
|
||||
}
|
||||
if(args[0].equals("client.destroy")) {
|
||||
else if(args[0].equals("client.destroy")) {
|
||||
int port = Integer.parseInt(args[1]);
|
||||
new Thread(()->{
|
||||
var t = clientTunnels.get(port);
|
||||
@@ -97,7 +105,7 @@ public class TunnelControl implements Runnable {
|
||||
}).start();
|
||||
out.println("OK");
|
||||
}
|
||||
if(args[0].equals("socks.create")) {
|
||||
else if(args[0].equals("socks.create")) {
|
||||
int port = Integer.parseInt(args[1]);
|
||||
new Thread(()->{
|
||||
var t = new I2PTunnel(new String[]{"-die", "-nocli", "-e", "sockstunnel " + port});
|
||||
@@ -105,7 +113,7 @@ public class TunnelControl implements Runnable {
|
||||
}).start();
|
||||
out.println("OK");
|
||||
}
|
||||
if(args[0].equals("socks.destroy")) {
|
||||
else if(args[0].equals("socks.destroy")) {
|
||||
int port = Integer.parseInt(args[1]);
|
||||
new Thread(()->{
|
||||
var t = socksTunnels.get(port);
|
||||
@@ -114,6 +122,14 @@ public class TunnelControl implements Runnable {
|
||||
}).start();
|
||||
out.println("OK");
|
||||
}
|
||||
else if(args[0].equals("sam.create")) {
|
||||
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();
|
||||
ClientAppManager mgr = new ClientAppManagerImpl(context);
|
||||
SAMBridge samBridge = new SAMBridge(context, mgr, samArgs);
|
||||
samBridge.startup();
|
||||
out.println("OK");
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user