From 56409c0177fb843831a5bacace21876e27ca7024 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Mon, 10 Nov 2014 13:34:22 +0100 Subject: [PATCH] Rename app.cli.{SeedNode => BootstrapNode} With this commit we're now using the naming "bootstrap node" everywhere as opposed to the more fuzzy notion of "seed node" (which was originally borrowed from Bitcoin Core, but doesn't really describe what we're up to very well. As it turns out, Kademlia also uses the terminology "bootstrap node" [1], so we're in good company with this change. [1]: https://en.wikipedia.org/wiki/Kademlia#Joining_the_network --- doc/bitsquare.conf | 7 ++----- .../java/io/bitsquare/app/ArgumentParser.java | 12 ++++++------ .../app/cli/{SeedNode.java => BootstrapNode.java} | 6 +++--- .../java/io/bitsquare/gui/main/MainModel.java | 2 +- .../msg/tomp2p/BootstrappedPeerFactory.java | 4 ++-- src/main/resources/bitsquare.properties | 12 +----------- src/test/java/io/bitsquare/msg/TomP2PTests.java | 15 +++++++-------- 7 files changed, 22 insertions(+), 36 deletions(-) rename src/main/java/io/bitsquare/app/cli/{SeedNode.java => BootstrapNode.java} (95%) diff --git a/doc/bitsquare.conf b/doc/bitsquare.conf index 0f15d3e90e..76dd87bf9c 100644 --- a/doc/bitsquare.conf +++ b/doc/bitsquare.conf @@ -13,13 +13,10 @@ # Mac OSX: # $HOME/Library/Application Support/Bitcoin/ -# /Users/username/Library/Application Support/Bitcoin/bitcoin.conf +# /Users/username/Library/Application Support/Bitcoin/bitcoin.conf # Supported properties: -# networkType=regtest | testnet | mainnet - -# defaultSeedNode=localhost | server +# networkType=regtest | testnet | mainnet networkType=regtest -defaultSeedNode=localhost \ No newline at end of file diff --git a/src/main/java/io/bitsquare/app/ArgumentParser.java b/src/main/java/io/bitsquare/app/ArgumentParser.java index ad1bf769f5..0b5ca26f0d 100644 --- a/src/main/java/io/bitsquare/app/ArgumentParser.java +++ b/src/main/java/io/bitsquare/app/ArgumentParser.java @@ -37,17 +37,17 @@ public class ArgumentParser { // Args for local node config parser.addArgument("--" + Node.NAME_KEY) - .help("Local node ID"); + .help("Local node name"); parser.addArgument("--" + Node.PORT_KEY) - .help("Local port to listen on"); + .help("Local node port"); - // Args for seed node config + // Args for bootstrap node config parser.addArgument("--" + BOOTSTRAP_NODE_NAME_KEY) - .help("Seed node ID"); + .help("Bootstrap node name"); parser.addArgument("--" + BOOTSTRAP_NODE_IP_KEY) - .help("Seed node IP"); + .help("Bootstrap node IP address"); parser.addArgument("--" + BOOTSTRAP_NODE_PORT_KEY) - .help("Seed node port"); + .help("Bootstrap node port"); // A custom network interface (needed at the moment for windows, but might be useful also later) parser.addArgument("--" + NETWORK_INTERFACE_KEY) diff --git a/src/main/java/io/bitsquare/app/cli/SeedNode.java b/src/main/java/io/bitsquare/app/cli/BootstrapNode.java similarity index 95% rename from src/main/java/io/bitsquare/app/cli/SeedNode.java rename to src/main/java/io/bitsquare/app/cli/BootstrapNode.java index 540dc798c0..b5d076a4a6 100644 --- a/src/main/java/io/bitsquare/app/cli/SeedNode.java +++ b/src/main/java/io/bitsquare/app/cli/BootstrapNode.java @@ -35,8 +35,8 @@ import org.slf4j.LoggerFactory; import net.sourceforge.argparse4j.inf.Namespace; -public class SeedNode { - private static final Logger log = LoggerFactory.getLogger(SeedNode.class); +public class BootstrapNode { + private static final Logger log = LoggerFactory.getLogger(BootstrapNode.class); private static Peer peer = null; private static boolean running = true; @@ -68,7 +68,7 @@ public class SeedNode { new PeerBuilderDHT(peer).start(); new PeerBuilderNAT(peer).start(); - log.debug("SeedNode started."); + log.debug("started"); new Thread(new Runnable() { @Override public void run() { diff --git a/src/main/java/io/bitsquare/gui/main/MainModel.java b/src/main/java/io/bitsquare/gui/main/MainModel.java index 49963ec5ed..6124599c29 100644 --- a/src/main/java/io/bitsquare/gui/main/MainModel.java +++ b/src/main/java/io/bitsquare/gui/main/MainModel.java @@ -104,7 +104,7 @@ class MainModel extends UIModel { void initBackend() { - // For testing with the serverside seednode we need the BootstrappedPeerFactory which gets started form + // For testing with the bootstrap node we need the BootstrappedPeerFactory which gets started from // messageFacade.init messageFacade.init(new BootstrapListener() { diff --git a/src/main/java/io/bitsquare/msg/tomp2p/BootstrappedPeerFactory.java b/src/main/java/io/bitsquare/msg/tomp2p/BootstrappedPeerFactory.java index d19294741d..9c76a2ff31 100644 --- a/src/main/java/io/bitsquare/msg/tomp2p/BootstrappedPeerFactory.java +++ b/src/main/java/io/bitsquare/msg/tomp2p/BootstrappedPeerFactory.java @@ -70,7 +70,7 @@ import org.slf4j.LoggerFactory; /** - * Creates a DHT peer and bootstrap to the network via a seed node + * Creates a DHT peer and bootstraps to the network via a bootstrap node */ class BootstrappedPeerFactory { private static final Logger log = LoggerFactory.getLogger(BootstrappedPeerFactory.class); @@ -201,7 +201,7 @@ class BootstrappedPeerFactory { // 1. Attempt: Try to discover our outside visible address private void discover() { - setState(BootstrapState.DIRECT_INIT, "We are starting to bootstrap to a seed node."); + setState(BootstrapState.DIRECT_INIT, "We are starting discovery against a bootstrap node."); FutureDiscover futureDiscover = peer.discover().peerAddress(getBootstrapAddress()).start(); futureDiscover.addListener(new BaseFutureListener() { @Override diff --git a/src/main/resources/bitsquare.properties b/src/main/resources/bitsquare.properties index 416874c054..93b4dec9d3 100644 --- a/src/main/resources/bitsquare.properties +++ b/src/main/resources/bitsquare.properties @@ -1,11 +1 @@ -seed.0.id=digitalocean1.bitsquare.io -seed.0.address=188.226.179.109 -seed.0.port=5000 - -seed.1.id=digitalocean2.bitsquare.io -seed.1.address=128.199.251.106 -seed.1.port=5000 - -seed.2.id=localhost -seed.2.address=127.0.0.1 -seed.2.port=5001 +# Empty for now; see ConfigLoader \ No newline at end of file diff --git a/src/test/java/io/bitsquare/msg/TomP2PTests.java b/src/test/java/io/bitsquare/msg/TomP2PTests.java index 4814f9f98a..848f4d4bb1 100644 --- a/src/test/java/io/bitsquare/msg/TomP2PTests.java +++ b/src/test/java/io/bitsquare/msg/TomP2PTests.java @@ -70,7 +70,7 @@ import static org.junit.Assert.*; * Test bootstrapping, DHT operations like put/get/add/remove and sendDirect in both LAN and WAN environment * Test scenarios in direct connection, auto port forwarding or relay mode. *

- * To start a seed node code use the {@link io.bitsquare.app.cli.SeedNode} class. + * To start a bootstrap node code use the {@link io.bitsquare.app.cli.BootstrapNode} class. *

* To configure your test environment edit the static fields for id, IP and port. * In the configure method and the connectionType you can define your test scenario. @@ -86,11 +86,10 @@ public class TomP2PTests { // If you want to test in one specific connection mode define it directly, otherwise use UNKNOWN private static final ConnectionType FORCED_CONNECTION_TYPE = ConnectionType.NAT; - // Typically you run the seed node in localhost to test direct connection. - // If you have a setup where you are not behind a router you can also use a WAN side seed node. - private static final Node BOOTSTRAP_NODE = - (FORCED_CONNECTION_TYPE == ConnectionType.DIRECT) ? BootstrapNodes.LOCALHOST : BootstrapNodes - .DIGITAL_OCEAN_1_DEV; + // Typically you run the bootstrap node on localhost to test direct connection. + // If you have a setup where you are not behind a router you can also use a WAN bootstrap node. + private static final Node BOOTSTRAP_NODE = (FORCED_CONNECTION_TYPE == ConnectionType.DIRECT) ? + BootstrapNodes.LOCALHOST : BootstrapNodes.DIGITAL_OCEAN_1_DEV; private static final PeerAddress BOOTSTRAP_NODE_ADDRESS; @@ -290,11 +289,11 @@ public class TomP2PTests { } } - // That test should always succeed as we use the server seed node as receiver. + // This test should always succeed as we use the bootstrap node as receiver. // A node can send a message to another peer which is not in the same LAN. @Test @Repeat(STRESS_TEST_COUNT) - public void testSendDirectToSeedNode() throws Exception { + public void testSendDirectToBootstrapNode() throws Exception { peer1DHT = getDHTPeer("node_1", client1Port); FuturePeerConnection futurePeerConnection = peer1DHT.peer().createPeerConnection(BOOTSTRAP_NODE_ADDRESS, 500);