mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-01 03:06:14 -04:00
Added command line option to set DHTManager seed peer ID
This commit is contained in:
parent
d24e4cfd84
commit
afa6af5fd1
2 changed files with 15 additions and 3 deletions
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package io.bitsquare;
|
package io.bitsquare;
|
||||||
|
|
||||||
|
import io.bitsquare.msg.SeedNodeAddress;
|
||||||
import io.bitsquare.msg.actor.DHTManager;
|
import io.bitsquare.msg.actor.DHTManager;
|
||||||
import io.bitsquare.msg.actor.command.InitializePeer;
|
import io.bitsquare.msg.actor.command.InitializePeer;
|
||||||
import io.bitsquare.msg.actor.event.PeerInitialized;
|
import io.bitsquare.msg.actor.event.PeerInitialized;
|
||||||
|
@ -76,6 +77,11 @@ public class BitSquare {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (namespace.getBoolean(BitsquareArgumentParser.SEED_FLAG) == true) {
|
if (namespace.getBoolean(BitsquareArgumentParser.SEED_FLAG) == true) {
|
||||||
|
String seedID = SeedNodeAddress.StaticSeedNodeAddresses.DIGITAL_OCEAN1.getId();
|
||||||
|
if (namespace.getString(BitsquareArgumentParser.SEED_ID_FLAG) != null) {
|
||||||
|
seedID = namespace.getString(BitsquareArgumentParser.SEED_ID_FLAG);
|
||||||
|
}
|
||||||
|
|
||||||
Integer port = BitsquareArgumentParser.PORT_DEFAULT;
|
Integer port = BitsquareArgumentParser.PORT_DEFAULT;
|
||||||
if (namespace.getString(BitsquareArgumentParser.PORT_FLAG) != null) {
|
if (namespace.getString(BitsquareArgumentParser.PORT_FLAG) != null) {
|
||||||
port = Integer.valueOf(namespace.getString(BitsquareArgumentParser.PORT_FLAG));
|
port = Integer.valueOf(namespace.getString(BitsquareArgumentParser.PORT_FLAG));
|
||||||
|
@ -85,7 +91,7 @@ public class BitSquare {
|
||||||
|
|
||||||
ActorRef seedNode = actorSystem.actorOf(DHTManager.getProps(), DHTManager.SEED_NAME);
|
ActorRef seedNode = actorSystem.actorOf(DHTManager.getProps(), DHTManager.SEED_NAME);
|
||||||
Inbox inbox = Inbox.create(actorSystem);
|
Inbox inbox = Inbox.create(actorSystem);
|
||||||
inbox.send(seedNode, new InitializePeer(Number160.createHash("localhost"), port, interfaceHint, null));
|
inbox.send(seedNode, new InitializePeer(Number160.createHash(seedID), port, interfaceHint, null));
|
||||||
|
|
||||||
Thread seedNodeThread = new Thread(() -> {
|
Thread seedNodeThread = new Thread(() -> {
|
||||||
Boolean quit = false;
|
Boolean quit = false;
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
package io.bitsquare.util;
|
package io.bitsquare.util;
|
||||||
|
|
||||||
|
import io.bitsquare.msg.SeedNodeAddress;
|
||||||
|
|
||||||
import net.sourceforge.argparse4j.ArgumentParsers;
|
import net.sourceforge.argparse4j.ArgumentParsers;
|
||||||
import net.sourceforge.argparse4j.impl.Arguments;
|
import net.sourceforge.argparse4j.impl.Arguments;
|
||||||
import net.sourceforge.argparse4j.inf.ArgumentParser;
|
import net.sourceforge.argparse4j.inf.ArgumentParser;
|
||||||
|
@ -26,6 +28,7 @@ import net.sourceforge.argparse4j.inf.Namespace;
|
||||||
public class BitsquareArgumentParser {
|
public class BitsquareArgumentParser {
|
||||||
|
|
||||||
public static String SEED_FLAG = "seed";
|
public static String SEED_FLAG = "seed";
|
||||||
|
public static String SEED_ID_FLAG = "seedid";
|
||||||
public static String PORT_FLAG = "port";
|
public static String PORT_FLAG = "port";
|
||||||
public static Integer PORT_DEFAULT = 5000;
|
public static Integer PORT_DEFAULT = 5000;
|
||||||
public static String INFHINT_FLAG = "interface";
|
public static String INFHINT_FLAG = "interface";
|
||||||
|
@ -39,7 +42,10 @@ public class BitsquareArgumentParser {
|
||||||
.description("BitSquare decentralized bitcoin exchange.");
|
.description("BitSquare decentralized bitcoin exchange.");
|
||||||
parser.addArgument("-s", "--" + SEED_FLAG)
|
parser.addArgument("-s", "--" + SEED_FLAG)
|
||||||
.action(Arguments.storeTrue())
|
.action(Arguments.storeTrue())
|
||||||
.help("Start in DHT seed mode, no UI.");
|
.help("Start as DHT seed node, no UI.");
|
||||||
|
parser.addArgument("-d", "--" + SEED_ID_FLAG)
|
||||||
|
.setDefault(SeedNodeAddress.StaticSeedNodeAddresses.DIGITAL_OCEAN1.getId())
|
||||||
|
.help("Seed node peer ID.");
|
||||||
parser.addArgument("-p", "--"+PORT_FLAG)
|
parser.addArgument("-p", "--"+PORT_FLAG)
|
||||||
.setDefault(PORT_DEFAULT)
|
.setDefault(PORT_DEFAULT)
|
||||||
.help("IP port to listen on.");
|
.help("IP port to listen on.");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue