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 # Example: google.com
# #
# [ips]: # [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. # List of ips where the Newcoin protocol is avialable.
# One ipv4 or ipv6 address per line. # One ipv4 or ipv6 address per line.
# A port may optionally be specified after adding a space to the address. # 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 # 2001:0db8:0100:f101:0210:a4ff:fee3:9566
# #
# [validators]: # [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. # 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: # Examples:
# amazon.com # redstem.com
# newegg.com # n9KorY8QtTdRx7TVDpwnG9NvyxsDwHUKUEeDLY3AkiGncVaSXZi5
# n9MqiExBcoG19UXwoLjBJnhsxEhAZMuWwJDRdkyDz1EkEkwzQTNt John Doe
# #
# [ips_url]: # [ips_url]:
# Only valid in "newcoin.txt". # Only valid in "newcoin.txt".

View File

@@ -57,19 +57,34 @@
# #
# Specify the file by specifying its full path. # Specify the file by specifying its full path.
# #
# Examples: C:/home/johndoe/newcoin/validators.txt # Examples:
# C:/home/johndoe/newcoin/validators.txt
# /home/johndoe/newcoin/validators.txt # /home/johndoe/newcoin/validators.txt
# #
# [validators]: # [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. # 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 # For domains, newcoind will probe for https web servers at the specied
# domain in the following order: newcoin.DOMAIN, www.DOMAIN, DOMAIN # domain in the following order: newcoin.DOMAIN, www.DOMAIN, DOMAIN
# #
# Examples: redstem.com # Examples:
# redstem.com
# n9KorY8QtTdRx7TVDpwnG9NvyxsDwHUKUEeDLY3AkiGncVaSXZi5 # n9KorY8QtTdRx7TVDpwnG9NvyxsDwHUKUEeDLY3AkiGncVaSXZi5
# n9MqiExBcoG19UXwoLjBJnhsxEhAZMuWwJDRdkyDz1EkEkwzQTNt John Doe # 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]: # [peer_ip]:
# IP address or domain to bind to allow external connections from peers. # IP address or domain to bind to allow external connections from peers.
# Defaults to not allow external connections from peers. # Defaults to not allow external connections from peers.

View File

@@ -11,6 +11,7 @@
#define SECTION_FEE_ACCOUNT_CREATE "fee_account_create" #define SECTION_FEE_ACCOUNT_CREATE "fee_account_create"
#define SECTION_FEE_DEFAULT "fee_default" #define SECTION_FEE_DEFAULT "fee_default"
#define SECTION_FEE_NICKNAME_CREATE "fee_nickname_create" #define SECTION_FEE_NICKNAME_CREATE "fee_nickname_create"
#define SECTION_IPS "ips"
#define SECTION_NETWORK_QUORUM "network_quorum" #define SECTION_NETWORK_QUORUM "network_quorum"
#define SECTION_PEER_CONNECT_LOW_WATER "peer_connect_low_water" #define SECTION_PEER_CONNECT_LOW_WATER "peer_connect_low_water"
#define SECTION_PEER_IP "peer_ip" #define SECTION_PEER_IP "peer_ip"
@@ -172,13 +173,21 @@ void Config::load()
section secConfig = ParseSection(strConfigFile, true); section secConfig = ParseSection(strConfigFile, true);
std::string strTemp; std::string strTemp;
// XXX Leak
section::mapped_type* smtTmp; section::mapped_type* smtTmp;
smtTmp = sectionEntries(secConfig, SECTION_VALIDATORS); smtTmp = sectionEntries(secConfig, SECTION_VALIDATORS);
if (smtTmp) if (smtTmp)
{ {
VALIDATORS = *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); (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::string VALIDATORS_SITE; // Where to find validators.txt on the Internet.
std::vector<std::string> VALIDATORS; // Validators from newcoind.cfg. std::vector<std::string> VALIDATORS; // Validators from newcoind.cfg.
std::vector<std::string> IPS; // Peer IPs from newcoind.cfg.
// Network parameters // Network parameters
int NETWORK_START_TIME; // The Unix time we start ledger 0. int NETWORK_START_TIME; // The Unix time we start ledger 0.