From 3cb3b41ceff88ad31e39a9734b227f3ff9cf7fad Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Tue, 20 Nov 2012 13:13:52 -0800 Subject: [PATCH] Rename unl_default to validators_file. --- rippled-example.cfg | 146 ++++++++++++++++++++++++++++++ src/cpp/ripple/Config.cpp | 6 +- src/cpp/ripple/Config.h | 2 +- src/cpp/ripple/RPCHandler.cpp | 2 +- src/cpp/ripple/UniqueNodeList.cpp | 6 +- 5 files changed, 154 insertions(+), 8 deletions(-) create mode 100644 rippled-example.cfg diff --git a/rippled-example.cfg b/rippled-example.cfg new file mode 100644 index 0000000000..a57fa3a8c2 --- /dev/null +++ b/rippled-example.cfg @@ -0,0 +1,146 @@ +# +# Sample rippled.cfg +# +# This file contains configuration information for rippled. +# +# This file should be named rippled.cfg. This file is UTF-8 with Dos, UNIX, +# or Mac style end of lines. Blank lines and lines beginning with '#' are +# ignored. Undefined sections are reserved. No escapes are currently defined. +# +# When you launch rippled, it will attempt to find this file. For details, +# refer to the manual page for --conf command line option. +# +# [debug_logfile] +# Specifies were a debug logfile is kept. By default, no debug log is kept +# +# Example: debug.log +# +# [validators_site]: +# Specifies where to find validators.txt for UNL boostrapping and RPC command unl_network. +# During alpha testing, this defaults to: redstem.com +# +# Example: ripple.com +# +# [validators_file]: +# Specifies how to bootstrap the UNL list. The UNL list is based on a +# validators.txt file and is maintained in the databases. When rippled +# starts up, if the databases are missing or are obsolete due to an upgrade +# of rippled, rippled will reconstruct the UNL list as specified here. +# +# If this entry is not present or empty, rippled will look for a validators.txt in the +# config directory. If not found there, it will attempt to retrieve the file +# from the Ripple foundation's web site. +# +# This entry is also used by the RPC command unl_load. +# +# Specify the file by specifying its full path. +# +# Examples: +# C:/home/johndoe/ripple/validators.txt +# /home/johndoe/ripple/validators.txt +# +# [validators]: +# Only valid in "rippled.cfg", "ripple.txt", and the referered [validators_url]. +# List of nodes to accept as validators speficied by public key or domain. +# +# For domains, rippled will probe for https web servers at the specied +# domain in the following order: ripple.DOMAIN, www.DOMAIN, DOMAIN +# +# Examples: +# redstem.com +# n9KorY8QtTdRx7TVDpwnG9NvyxsDwHUKUEeDLY3AkiGncVaSXZi5 +# n9MqiExBcoG19UXwoLjBJnhsxEhAZMuWwJDRdkyDz1EkEkwzQTNt John Doe +# +# [ips]: +# Only valid in "rippled.cfg", "ripple.txt", and the referered [ips_url]. +# List of ips where the Newcoin protocol is avialable. +# One ipv4 or ipv6 address per line. +# A port may optionally be specified after adding a space to the address. +# By convention, if known, IPs are listed in from most to least trusted. +# +# Examples: +# 192.168.0.1 +# 192.168.0.1 3939 +# 2001:0db8:0100:f101:0210:a4ff:fee3:9566 +# +# [sntp_servers] +# IP address or domain of servers to use for time synchronization. +# The default time servers are suitable for servers located in the United States +# +# [peer_ip]: +# IP address or domain to bind to allow external connections from peers. +# Defaults to not allow external connections from peers. +# +# Examples: 0.0.0.0 - Bind on all interfaces. +# +# [peer_port]: +# Port to bind to allow external connections from peers. +# +# [rpc_ip]: +# IP address or domain to bind to allow insecure RPC connections. +# Defaults to not allow RPC connections. +# +# [rpc_port]: +# Port to bind to if allowing insecure RPC connections. +# +# [rpc_allow_remote]: +# 0 or 1. 0 only allows RPC connections from 127.0.0.1. [default 0] +# +# [websocket_ip]: +# IP address or domain to bind to allow client connections. +# +# Examples: 0.0.0.0 - Bind on all interfaces. +# 127.0.0.1 - Bind on localhost interface. Only local programs may connect. +# +# [websocket_port]: +# Port to bind to allow client connections. +# +# [validation_seed]: +# To perform validation, this section should contain either a validation seed or key. +# The validation seed is used to generate the validation public/private key pair. +# To obtain a validation seed, use the validation_create command. +# +# Examples: RASH BUSH MILK LOOK BAD BRIM AVID GAFF BAIT ROT POD LOVE +# shfArahZT9Q9ckTf3s1psJ7C7qzVN +# + +[peer_ip] +0.0.0.0 + +[peer_port] +51235 + +[rpc_ip] +127.0.0.1 + +[rpc_port] +5005 + +[rpc_allow_remote] +1 + +[websocket_ip] +0.0.0.0 + +[websocket_port] +5006 + +[debug_logfile] +log/debug.log + +[sntp_servers] +time.windows.com +time.apple.com +time.nist.gov +pool.ntp.org + +[validation_seed] +shh1D4oj5czH3PUEjYES8c7Bay3tE + +[unl_default] +validators.txt + +[ips] +23.21.167.100 51235 +23.23.201.55 51235 +107.21.116.214 51235 diff --git a/src/cpp/ripple/Config.cpp b/src/cpp/ripple/Config.cpp index 8a665ff134..68f2e31926 100644 --- a/src/cpp/ripple/Config.cpp +++ b/src/cpp/ripple/Config.cpp @@ -27,7 +27,7 @@ #define SECTION_RPC_IP "rpc_ip" #define SECTION_RPC_PORT "rpc_port" #define SECTION_SNTP "sntp_servers" -#define SECTION_UNL_DEFAULT "unl_default" +#define SECTION_VALIDATORS_FILE "validators_file" #define SECTION_VALIDATION_QUORUM "validation_quorum" #define SECTION_VALIDATION_SEED "validation_seed" #define SECTION_WEBSOCKET_PUBLIC_IP "websocket_public_ip" @@ -292,8 +292,8 @@ void Config::load() if (sectionSingleB(secConfig, SECTION_ACCOUNT_PROBE_MAX, strTemp)) ACCOUNT_PROBE_MAX = boost::lexical_cast(strTemp); - if (sectionSingleB(secConfig, SECTION_UNL_DEFAULT, strTemp)) - UNL_DEFAULT = strTemp; + if (sectionSingleB(secConfig, SECTION_VALIDATORS_FILE, strTemp)) + VALIDATORS_FILE = strTemp; if (sectionSingleB(secConfig, SECTION_DEBUG_LOGFILE, strTemp)) DEBUG_LOGFILE = strTemp; diff --git a/src/cpp/ripple/Config.h b/src/cpp/ripple/Config.h index 3807b51dff..199b4292ed 100644 --- a/src/cpp/ripple/Config.h +++ b/src/cpp/ripple/Config.h @@ -50,7 +50,7 @@ public: boost::filesystem::path CONFIG_DIR; boost::filesystem::path DATA_DIR; boost::filesystem::path DEBUG_LOGFILE; - boost::filesystem::path UNL_DEFAULT; + boost::filesystem::path VALIDATORS_FILE; std::string VALIDATORS_SITE; // Where to find validators.txt on the Internet. std::vector VALIDATORS; // Validators from rippled.cfg. diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index ba9f6f78b9..6d6a4595ec 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -1638,7 +1638,7 @@ Json::Value RPCHandler::doUnlList(const Json::Value& params) // Populate the UNL from a local validators.txt file. Json::Value RPCHandler::doUnlLoad(const Json::Value& params) { - if (theConfig.UNL_DEFAULT.empty() || !theApp->getUNL().nodeLoad(theConfig.UNL_DEFAULT)) + if (theConfig.VALIDATORS_FILE.empty() || !theApp->getUNL().nodeLoad(theConfig.VALIDATORS_FILE)) { return rpcError(rpcLOAD_FAILED); } diff --git a/src/cpp/ripple/UniqueNodeList.cpp b/src/cpp/ripple/UniqueNodeList.cpp index f372fcba7b..9b9c55a5d1 100644 --- a/src/cpp/ripple/UniqueNodeList.cpp +++ b/src/cpp/ripple/UniqueNodeList.cpp @@ -1576,15 +1576,15 @@ void UniqueNodeList::nodeBootstrap() bool bLoaded = iDomains || iNodes; // Always merge in the file specified in the config. - if (!theConfig.UNL_DEFAULT.empty()) + if (!theConfig.VALIDATORS_FILE.empty()) { cLog(lsINFO) << "Bootstrapping UNL: loading from unl_default."; - bLoaded = nodeLoad(theConfig.UNL_DEFAULT); + bLoaded = nodeLoad(theConfig.VALIDATORS_FILE); } // If never loaded anything try the current directory. - if (!bLoaded && theConfig.UNL_DEFAULT.empty()) + if (!bLoaded && theConfig.VALIDATORS_FILE.empty()) { cLog(lsINFO) << "Bootstrapping UNL: loading from '" VALIDATORS_FILE_NAME "'.";