Support ipv6 for peer and RPC comms:

Fixes: RIPD-1574

Alias beast address classes to the asio equivalents. Adjust users of
address classes accordingly. Fix resolver class so that it can support
ipv6 addresses. Make unit tests use ipv6 localhost network. Extend
endpoint peer message to support string endpoint
representations while also supporting the existing fields (both are
optional/repeated types). Expand test for Livecache and Endpoint.
Workaround some false positive ipaddr tests on windows (asio bug?)
Replaced usage of address::from_string(deprecated) with free function
make_address. Identified a remaining use of v4 address type and
replaced with the more appropriate IPEndpoint type (rpc_ip cmdline
option). Add CLI flag for using ipv4 with unit tests.

Release Notes
-------------

The optional rpc_port command line flag is deprecated. The rpc_ip
parameter now works as documented and accepts ip and port combined.
This commit is contained in:
Mike Ellery
2017-11-08 10:10:24 -08:00
parent fd4636b056
commit 08382d866b
41 changed files with 968 additions and 1253 deletions

View File

@@ -172,21 +172,12 @@ private:
while (list2.size () < listSize)
list2.push_back (randomValidator());
using endpoint_type = boost::asio::ip::tcp::endpoint;
using address_type = boost::asio::ip::address;
// Use ports of 0 to allow OS selection
endpoint_type ep1{address_type::from_string("127.0.0.1"), 0};
endpoint_type ep2{address_type::from_string("127.0.0.1"), 0};
auto const sequence = 1;
auto const version = 1;
NetClock::time_point const expiration =
env.timeKeeper().now() + 3600s;
TrustedPublisherServer server1(
ep1,
env.app().getIOService(),
pubSigningKeys1,
manifest1,
@@ -196,7 +187,6 @@ private:
list1);
TrustedPublisherServer server2(
ep2,
env.app().getIOService(),
pubSigningKeys2,
manifest2,
@@ -205,14 +195,13 @@ private:
version,
list2);
std::uint16_t const port1 = server1.local_endpoint().port();
std::uint16_t const port2 = server2.local_endpoint().port();
std::stringstream url1, url2;
url1 << "http://" << server1.local_endpoint() << "/validators";
url2 << "http://" << server2.local_endpoint() << "/validators";
{
// fetch single site
std::vector<std::string> cfgSites(
{"http://127.0.0.1:" + std::to_string(port1) + "/validators"});
std::vector<std::string> cfgSites({ url1.str() });
auto sites = std::make_unique<ValidatorSite> (
env.app().getIOService(), env.app().validators(), journal);
@@ -229,9 +218,7 @@ private:
}
{
// fetch multiple sites
std::vector<std::string> cfgSites({
"http://127.0.0.1:" + std::to_string(port1) + "/validators",
"http://127.0.0.1:" + std::to_string(port2) + "/validators"});
std::vector<std::string> cfgSites({ url1.str(), url2.str() });
auto sites = std::make_unique<ValidatorSite> (
env.app().getIOService(), env.app().validators(), journal);