diff options
author | Tim L <timo614@gmail.com> | 2017-11-15 22:58:11 -0500 |
---|---|---|
committer | Tim L <timo614@gmail.com> | 2017-11-17 16:23:41 -0500 |
commit | 23b6f685de3df9c073078bc60f6f87d7c8d6f8f7 (patch) | |
tree | 218486e11d34d8759d5d62b7e97ae4916a451194 /src/rpc/core_rpc_server.cpp | |
parent | Merge pull request #2818 (diff) | |
download | monero-23b6f685de3df9c073078bc60f6f87d7c8d6f8f7.tar.xz |
RPC: allow binding of restricted port in addition to core port
Diffstat (limited to 'src/rpc/core_rpc_server.cpp')
-rw-r--r-- | src/rpc/core_rpc_server.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index 6e7fb7e8e..1a5e928a8 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -68,7 +68,9 @@ namespace cryptonote void core_rpc_server::init_options(boost::program_options::options_description& desc) { command_line::add_arg(desc, arg_rpc_bind_port); + command_line::add_arg(desc, arg_rpc_restricted_bind_port); command_line::add_arg(desc, arg_testnet_rpc_bind_port); + command_line::add_arg(desc, arg_testnet_rpc_restricted_bind_port); command_line::add_arg(desc, arg_restricted_rpc); cryptonote::rpc_args::init_options(desc); } @@ -83,21 +85,21 @@ namespace cryptonote //------------------------------------------------------------------------------------------------------------------------------ bool core_rpc_server::init( const boost::program_options::variables_map& vm + , const bool restricted + , const bool testnet + , const std::string& port ) { - m_testnet = command_line::get_arg(vm, cryptonote::arg_testnet_on); + m_restricted = restricted; + m_testnet = testnet; m_net_server.set_threads_prefix("RPC"); - auto p2p_bind_arg = m_testnet ? arg_testnet_rpc_bind_port : arg_rpc_bind_port; - auto rpc_config = cryptonote::rpc_args::process(vm); if (!rpc_config) return false; - m_restricted = command_line::get_arg(vm, arg_restricted_rpc); - boost::optional<epee::net_utils::http::login> http_login{}; - std::string port = command_line::get_arg(vm, p2p_bind_arg); + if (rpc_config->login) http_login.emplace(std::move(rpc_config->login->username), std::move(rpc_config->login->password).password()); @@ -1780,12 +1782,24 @@ namespace cryptonote , std::to_string(config::RPC_DEFAULT_PORT) }; + const command_line::arg_descriptor<std::string> core_rpc_server::arg_rpc_restricted_bind_port = { + "rpc-restricted-bind-port" + , "Port for restricted RPC server" + , "" + }; + const command_line::arg_descriptor<std::string> core_rpc_server::arg_testnet_rpc_bind_port = { "testnet-rpc-bind-port" , "Port for testnet RPC server" , std::to_string(config::testnet::RPC_DEFAULT_PORT) }; + const command_line::arg_descriptor<std::string> core_rpc_server::arg_testnet_rpc_restricted_bind_port = { + "testnet-rpc-restricted-bind-port" + , "Port for testnet restricted RPC server" + , "" + }; + const command_line::arg_descriptor<bool> core_rpc_server::arg_restricted_rpc = { "restricted-rpc" , "Restrict RPC to view only commands and do not return privacy sensitive data in RPC calls" |