Config support for [ips].

This commit is contained in:
Arthur Britto
2012-06-19 12:45:01 -07:00
parent d76cc94f0c
commit c9d06c3fb2
4 changed files with 39 additions and 10 deletions

View File

@@ -31,7 +31,7 @@
# Example: google.com
#
# [ips]:
# Only valid in "newcoin.txt" and the referered [ips_url].
# Only valid in "newcoind.cfg", "newcoin.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.
@@ -43,12 +43,16 @@
# 2001:0db8:0100:f101:0210:a4ff:fee3:9566
#
# [validators]:
# Only valid in "newcoin.txt" and the referered [validators_url].
# Only valid in "newcoind.cfg", "newcoin.txt", and the referered [validators_url].
# List of Newcoin validators this node recommends.
#
# For domains, newcoind will probe for https web servers at the specied
# domain in the following order: newcoin.DOMAIN, www.DOMAIN, DOMAIN
#
# Examples:
# amazon.com
# newegg.com
# redstem.com
# n9KorY8QtTdRx7TVDpwnG9NvyxsDwHUKUEeDLY3AkiGncVaSXZi5
# n9MqiExBcoG19UXwoLjBJnhsxEhAZMuWwJDRdkyDz1EkEkwzQTNt John Doe
#
# [ips_url]:
# Only valid in "newcoin.txt".

View File

@@ -57,18 +57,33 @@
#
# Specify the file by specifying its full path.
#
# Examples: C:/home/johndoe/newcoin/validators.txt
# /home/johndoe/newcoin/validators.txt
# Examples:
# C:/home/johndoe/newcoin/validators.txt
# /home/johndoe/newcoin/validators.txt
#
# [validators]:
# Only valid in "newcoind.cfg", "newcoin.txt", and the referered [validators_url].
# List of nodes to accept as validators speficied by public key or domain.
#
# For domains, newcoind will probe for https web servers at the specied
# domain in the following order: newcoin.DOMAIN, www.DOMAIN, DOMAIN
#
# Examples: redstem.com
# n9KorY8QtTdRx7TVDpwnG9NvyxsDwHUKUEeDLY3AkiGncVaSXZi5
# n9MqiExBcoG19UXwoLjBJnhsxEhAZMuWwJDRdkyDz1EkEkwzQTNt John Doe
# Examples:
# redstem.com
# n9KorY8QtTdRx7TVDpwnG9NvyxsDwHUKUEeDLY3AkiGncVaSXZi5
# n9MqiExBcoG19UXwoLjBJnhsxEhAZMuWwJDRdkyDz1EkEkwzQTNt John Doe
#
# [ips]:
# Only valid in "newcoind.cfg", "newcoin.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
#
# [peer_ip]:
# IP address or domain to bind to allow external connections from peers.

View File

@@ -11,6 +11,7 @@
#define SECTION_FEE_ACCOUNT_CREATE "fee_account_create"
#define SECTION_FEE_DEFAULT "fee_default"
#define SECTION_FEE_NICKNAME_CREATE "fee_nickname_create"
#define SECTION_IPS "ips"
#define SECTION_NETWORK_QUORUM "network_quorum"
#define SECTION_PEER_CONNECT_LOW_WATER "peer_connect_low_water"
#define SECTION_PEER_IP "peer_ip"
@@ -172,13 +173,21 @@ void Config::load()
section secConfig = ParseSection(strConfigFile, true);
std::string strTemp;
// XXX Leak
section::mapped_type* smtTmp;
smtTmp = sectionEntries(secConfig, SECTION_VALIDATORS);
if (smtTmp)
{
VALIDATORS = *smtTmp;
sectionEntriesPrint(&VALIDATORS, SECTION_VALIDATORS);
// sectionEntriesPrint(&VALIDATORS, SECTION_VALIDATORS);
}
smtTmp = sectionEntries(secConfig, SECTION_IPS);
if (smtTmp)
{
IPS = *smtTmp;
sectionEntriesPrint(&IPS, SECTION_IPS);
}
(void) sectionSingleB(secConfig, SECTION_VALIDATORS_SITE, VALIDATORS_SITE);

View File

@@ -54,6 +54,7 @@ public:
std::string VALIDATORS_SITE; // Where to find validators.txt on the Internet.
std::vector<std::string> VALIDATORS; // Validators from newcoind.cfg.
std::vector<std::string> IPS; // Peer IPs from newcoind.cfg.
// Network parameters
int NETWORK_START_TIME; // The Unix time we start ledger 0.