forked from I2P_Developers/i2p.i2p
Router, i2ptunnel: Add option for per-pool persistent random key,
so peer ordering does not change across restarts
This commit is contained in:
@@ -25,6 +25,7 @@ import net.i2p.I2PAppContext;
|
||||
import net.i2p.app.ClientAppManager;
|
||||
import net.i2p.app.Outproxy;
|
||||
import net.i2p.client.I2PClient;
|
||||
import net.i2p.data.Base64;
|
||||
import net.i2p.data.Certificate;
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.data.Destination;
|
||||
@@ -1331,6 +1332,20 @@ public class IndexBean {
|
||||
}
|
||||
}
|
||||
|
||||
// As of 0.9.17, add a persistent random key if not present
|
||||
if (!isClient(_type) || _booleanOptions.contains("persistentClientKey")) {
|
||||
String p = OPT + "inbound.randomKey";
|
||||
if (!config.containsKey(p)) {
|
||||
// as of 0.9.17, add a random key if not previously present
|
||||
byte[] rk = new byte[32];
|
||||
_context.random().nextBytes(rk);
|
||||
config.setProperty(OPT + p, Base64.encode(rk));
|
||||
p = OPT + "outbound.randomKey";
|
||||
_context.random().nextBytes(rk);
|
||||
config.setProperty(OPT + p, Base64.encode(rk));
|
||||
}
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user