提交 46a83adb 编写于 作者: K Kevin Heifner 提交者: Matt Witherspoon

Merge pull request #828 from brianjohnson5972/186-update-endpoint-config

STAT-186 Update Endpoint Config

(reapplied on noon branch)
上级 0703e7cf
......@@ -98,7 +98,7 @@ namespace eosio {
void http_plugin::set_program_options(options_description&, options_description& cfg) {
cfg.add_options()
("http-server-endpoint", bpo::value<string>()->default_value("127.0.0.1:8888"),
("http-server-address", bpo::value<string>()->default_value("127.0.0.1:8888"),
"The local IP and port to listen for incoming http connections.")
("access-control-allow-origin", bpo::value<string>()->notifier([this](const string& v) {
......@@ -124,15 +124,15 @@ namespace eosio {
}
void http_plugin::plugin_initialize(const variables_map& options) {
if(options.count("http-server-endpoint")) {
if(options.count("http-server-address")) {
#if 0
auto lipstr = options.at("http-server-endpoint").as< string >();
auto lipstr = options.at("http-server-address").as< string >();
auto fcep = fc::ip::endpoint::from_string(lipstr);
my->listen_endpoint = tcp::endpoint(boost::asio::ip::address_v4::from_string((string)fcep.get_address()), fcep.port());
#endif
auto resolver = std::make_shared<tcp::resolver>( std::ref( app().get_io_service() ) );
if( options.count( "http-server-endpoint" ) ) {
auto lipstr = options.at("http-server-endpoint").as< string >();
if( options.count( "http-server-address" ) ) {
auto lipstr = options.at("http-server-address").as< string >();
auto host = lipstr.substr( 0, lipstr.find(':') );
auto port = lipstr.substr( host.size()+1, lipstr.size() );
idump((host)(port));
......
......@@ -88,8 +88,8 @@ void net_api_plugin::plugin_startup() {
}
void net_api_plugin::plugin_initialize(const variables_map& options) {
if (options.count("http-server-endpoint")) {
const auto& lipstr = options.at("http-server-endpoint").as<string>();
if (options.count("http-server-address")) {
const auto& lipstr = options.at("http-server-address").as<string>();
const auto& host = lipstr.substr(0, lipstr.find(':'));
if (host != "localhost" && host != "127.0.0.1") {
wlog("\n"
......
......@@ -2271,9 +2271,9 @@ namespace eosio {
void net_plugin::set_program_options( options_description& /*cli*/, options_description& cfg )
{
cfg.add_options()
( "listen-endpoint", bpo::value<string>()->default_value( "0.0.0.0:9876" ), "The actual host:port used to listen for incoming p2p connections.")
( "public-endpoint", bpo::value<string>(), "An externally accessible host:port for identifying this node. Defaults to listen-endpoint.")
( "remote-endpoint", bpo::value< vector<string> >()->composing(), "The public endpoint of a peer node to connect to. Use multiple remote-endpoint options as needed to compose a network.")
( "p2p-listen-endpoint", bpo::value<string>()->default_value( "0.0.0.0:9876" ), "The actual host:port used to listen for incoming p2p connections.")
( "p2p-server-address", bpo::value<string>(), "An externally accessible host:port for identifying this node. Defaults to p2p-listen-endpoint.")
( "p2p-peer-address", bpo::value< vector<string> >()->composing(), "The public endpoint of a peer node to connect to. Use multiple p2p-peer-address options as needed to compose a network.")
( "agent-name", bpo::value<string>()->default_value("\"EOS Test Agent\""), "The name supplied to identify this node amongst the peers.")
( "send-whole-blocks", bpo::value<bool>()->default_value(def_send_whole_blocks), "True to always send full blocks, false to send block summaries" )
( "allowed-connection", bpo::value<vector<string>>()->multitoken()->default_value({"any"}, "any"), "Can be 'any' or 'producers' or 'specified' or 'none'. If 'specified', peer-key must be specified at least once. If only 'producers', peer-key is not required. 'producers' and 'specified' may be combined.")
......@@ -2337,8 +2337,8 @@ namespace eosio {
my->started_sessions = 0;
my->resolver = std::make_shared<tcp::resolver>( std::ref( app().get_io_service() ) );
if(options.count("listen-endpoint")) {
my->p2p_address = options.at("listen-endpoint").as< string >();
if(options.count("p2p-listen-endpoint")) {
my->p2p_address = options.at("p2p-listen-endpoint").as< string >();
auto host = my->p2p_address.substr( 0, my->p2p_address.find(':') );
auto port = my->p2p_address.substr( host.size()+1, my->p2p_address.size() );
idump((host)(port));
......@@ -2349,8 +2349,8 @@ namespace eosio {
my->acceptor.reset( new tcp::acceptor( app().get_io_service() ) );
}
if(options.count("public-endpoint")) {
my->p2p_address = options.at("public-endpoint").as< string >();
if(options.count("p2p-server-address")) {
my->p2p_address = options.at("p2p-server-address").as< string >();
}
else {
if(my->listen_endpoint.address().to_v4() == address_v4::any()) {
......@@ -2367,8 +2367,8 @@ namespace eosio {
}
}
if(options.count("remote-endpoint")) {
my->supplied_peers = options.at("remote-endpoint").as<vector<string> >();
if(options.count("p2p-peer-address")) {
my->supplied_peers = options.at("p2p-peer-address").as<vector<string> >();
}
if(options.count("agent-name")) {
my->user_agent_name = options.at("agent-name").as<string>();
......
......@@ -97,8 +97,8 @@ void wallet_api_plugin::plugin_startup() {
}
void wallet_api_plugin::plugin_initialize(const variables_map& options) {
if (options.count("http-server-endpoint")) {
const auto& lipstr = options.at("http-server-endpoint").as<string>();
if (options.count("http-server-address")) {
const auto& lipstr = options.at("http-server-address").as<string>();
const auto& host = lipstr.substr(0, lipstr.find(':'));
if (host != "localhost" && host != "127.0.0.1") {
wlog("\n"
......
......@@ -774,9 +774,9 @@ launcher_def::write_config_file (tn_node_def &node) {
<< "send-whole-blocks = true\n"
<< "shared-file-dir = blockchain\n"
<< "shared-file-size = " << instance.file_size << "\n"
<< "http-server-endpoint = " << host->host_name << ":" << instance.http_port << "\n"
<< "listen-endpoint = " << host->listen_addr << ":" << instance.p2p_port << "\n"
<< "public-endpoint = " << host->public_name << ":" << instance.p2p_port << "\n";
<< "http-server-address = " << host->host_name << ":" << instance.http_port << "\n"
<< "p2p-listen-endpoint = " << host->listen_addr << ":" << instance.p2p_port << "\n"
<< "p2p-server-address = " << host->public_name << ":" << instance.p2p_port << "\n";
if (allowed_connections & PC_ANY) {
cfg << "allowed-connection = any\n";
}
......@@ -793,7 +793,7 @@ launcher_def::write_config_file (tn_node_def &node) {
}
}
for (const auto &p : node.peers) {
cfg << "remote-endpoint = " << network.nodes.find(p)->second.instance->p2p_endpoint << "\n";
cfg << "p2p-peer-address = " << network.nodes.find(p)->second.instance->p2p_endpoint << "\n";
}
if (node.producers.size()) {
cfg << "required-participation = true\n";
......
......@@ -153,7 +153,7 @@ fi
#
# walletd
programs/eos-walletd/eos-walletd --data-dir test_wallet_0 --http-server-endpoint=127.0.0.1:8899 > test_walletd_output.log 2>&1 &
programs/eos-walletd/eos-walletd --data-dir test_wallet_0 --http-server-address=127.0.0.1:8899 > test_walletd_output.log 2>&1 &
verifyErrorCode "eos-walletd"
WALLETD_PROC_ID=$!
sleep 3
......
......@@ -102,11 +102,11 @@ sub write_config {
print $cfg "readonly = 0\n";
print $cfg "shared-file-dir = blockchain\n";
print $cfg "shared-file-size = 64\n";
print $cfg "http-server-endpoint = 127.0.0.1:$http_port[$i]\n";
print $cfg "listen-endpoint = 0.0.0.0:$p2p_port[$i]\n";
print $cfg "public-endpoint = $hostname:$p2p_port[$i]\n";
print $cfg "http-server-address = 127.0.0.1:$http_port[$i]\n";
print $cfg "p2p-listen-endpoint = 0.0.0.0:$p2p_port[$i]\n";
print $cfg "p2p-server-address = $hostname:$p2p_port[$i]\n";
foreach my $peer (@peers) {
print $cfg "remote-endpoint = $peer\n";
print $cfg "p2p-peer-address = $peer\n";
}
if (defined $producer) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册