| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
#ifndef DAEMON_COMMAND_LINE_ARGS_H |
| 30 |
#define DAEMON_COMMAND_LINE_ARGS_H |
| 31 |
|
| 32 |
#include "common/command_line.h" |
| 33 |
#include "cryptonote_config.h" |
| 34 |
#include "daemonizer/daemonizer.h" |
| 35 |
|
| 36 |
namespace daemon_args |
| 37 |
{ |
| 38 |
std::string const WINDOWS_SERVICE_NAME = "Monero Daemon"; |
| 39 |
|
| 40 |
const command_line::arg_descriptor<std::string, false, true, 2> arg_config_file = { |
| 41 |
"config-file" |
| 42 |
, "Specify configuration file" |
| 43 |
, (daemonizer::get_default_data_dir() / std::string(CRYPTONOTE_NAME ".conf")).string() |
| 44 |
, {{ &cryptonote::arg_testnet_on, &cryptonote::arg_stagenet_on }} |
| 45 |
, [](std::array<bool, 2> testnet_stagenet, bool defaulted, std::string val)->std::string { |
| 46 |
if (testnet_stagenet[0] && defaulted) |
| 47 |
return (daemonizer::get_default_data_dir() / "testnet" / |
| 48 |
std::string(CRYPTONOTE_NAME ".conf")).string(); |
| 49 |
else if (testnet_stagenet[1] && defaulted) |
| 50 |
return (daemonizer::get_default_data_dir() / "stagenet" / |
| 51 |
std::string(CRYPTONOTE_NAME ".conf")).string(); |
| 52 |
return val; |
| 53 |
} |
| 54 |
}; |
| 55 |
const command_line::arg_descriptor<std::string, false, true, 2> arg_log_file = { |
| 56 |
"log-file" |
| 57 |
, "Specify log file" |
| 58 |
, (daemonizer::get_default_data_dir() / std::string(CRYPTONOTE_NAME ".log")).string() |
| 59 |
, {{ &cryptonote::arg_testnet_on, &cryptonote::arg_stagenet_on }} |
| 60 |
, [](std::array<bool, 2> testnet_stagenet, bool defaulted, std::string val)->std::string { |
| 61 |
if (testnet_stagenet[0] && defaulted) |
| 62 |
return (daemonizer::get_default_data_dir() / "testnet" / |
| 63 |
std::string(CRYPTONOTE_NAME ".log")).string(); |
| 64 |
else if (testnet_stagenet[1] && defaulted) |
| 65 |
return (daemonizer::get_default_data_dir() / "stagenet" / |
| 66 |
std::string(CRYPTONOTE_NAME ".log")).string(); |
| 67 |
return val; |
| 68 |
} |
| 69 |
}; |
| 70 |
const command_line::arg_descriptor<std::size_t> arg_max_log_file_size = { |
| 71 |
"max-log-file-size" |
| 72 |
, "Specify maximum log file size [B]" |
| 73 |
, MAX_LOG_FILE_SIZE |
| 74 |
}; |
| 75 |
const command_line::arg_descriptor<std::size_t> arg_max_log_files = { |
| 76 |
"max-log-files" |
| 77 |
, "Specify maximum number of rotated log files to be saved (no limit by setting to 0)" |
| 78 |
, MAX_LOG_FILES |
| 79 |
}; |
| 80 |
const command_line::arg_descriptor<std::string> arg_log_level = { |
| 81 |
"log-level" |
| 82 |
, "" |
| 83 |
, "" |
| 84 |
}; |
| 85 |
const command_line::arg_descriptor<std::vector<std::string>> arg_command = { |
| 86 |
"daemon_command" |
| 87 |
, "Hidden" |
| 88 |
}; |
| 89 |
const command_line::arg_descriptor<bool> arg_os_version = { |
| 90 |
"os-version" |
| 91 |
, "OS for which this executable was compiled" |
| 92 |
}; |
| 93 |
const command_line::arg_descriptor<unsigned> arg_max_concurrency = { |
| 94 |
"max-concurrency" |
| 95 |
, "Max number of threads to use for a parallel job" |
| 96 |
, 0 |
| 97 |
}; |
| 98 |
|
| 99 |
const command_line::arg_descriptor<std::string> arg_proxy = { |
| 100 |
"proxy", |
| 101 |
"Network communication through proxy: [socks5://[user:pass@]]<socks-ip:port> i.e. \"127.0.0.1:9050\"", |
| 102 |
"", |
| 103 |
}; |
| 104 |
const command_line::arg_descriptor<bool> arg_proxy_allow_dns_leaks = { |
| 105 |
"proxy-allow-dns-leaks", |
| 106 |
"Allow DNS leaks outside of proxy", |
| 107 |
false, |
| 108 |
}; |
| 109 |
const command_line::arg_descriptor<bool> arg_public_node = { |
| 110 |
"public-node" |
| 111 |
, "Allow other users to use the node as a remote (restricted RPC mode, view-only commands) and advertise it over P2P" |
| 112 |
, false |
| 113 |
}; |
| 114 |
|
| 115 |
const command_line::arg_descriptor<std::string> arg_zmq_rpc_bind_ip = { |
| 116 |
"zmq-rpc-bind-ip" |
| 117 |
, "IP for ZMQ RPC server to listen on" |
| 118 |
, "127.0.0.1" |
| 119 |
}; |
| 120 |
|
| 121 |
const command_line::arg_descriptor<std::string, false, true, 2> arg_zmq_rpc_bind_port = { |
| 122 |
"zmq-rpc-bind-port" |
| 123 |
, "Port for ZMQ RPC server to listen on" |
| 124 |
, std::to_string(config::ZMQ_RPC_DEFAULT_PORT) |
| 125 |
, {{ &cryptonote::arg_testnet_on, &cryptonote::arg_stagenet_on }} |
| 126 |
, [](std::array<bool, 2> testnet_stagenet, bool defaulted, std::string val)->std::string { |
| 127 |
if (testnet_stagenet[0] && defaulted) |
| 128 |
return std::to_string(config::testnet::ZMQ_RPC_DEFAULT_PORT); |
| 129 |
if (testnet_stagenet[1] && defaulted) |
| 130 |
return std::to_string(config::stagenet::ZMQ_RPC_DEFAULT_PORT); |
| 131 |
return val; |
| 132 |
} |
| 133 |
}; |
| 134 |
const command_line::arg_descriptor<std::vector<std::string>> arg_zmq_pub = { |
| 135 |
"zmq-pub" |
| 136 |
, "Address for ZMQ pub - tcp://ip:port or ipc://path" |
| 137 |
}; |
| 138 |
|
| 139 |
const command_line::arg_descriptor<bool> arg_restricted_zmq_rpc = { |
| 140 |
"restricted-zmq-rpc" |
| 141 |
, "Restrict ZMQ RPC by disabling some sensitive methods; does not guarantee filtering of sensitive data" |
| 142 |
, false |
| 143 |
}; |
| 144 |
|
| 145 |
const command_line::arg_descriptor<bool> arg_confirm_zmq_rpc_external_bind = { |
| 146 |
"confirm-zmq-rpc-external-bind" |
| 147 |
, "Confirm zmq-rpc-bind-ip value is NOT a loopback (local) IP" |
| 148 |
, false |
| 149 |
}; |
| 150 |
|
| 151 |
const command_line::arg_descriptor<bool> arg_zmq_rpc_disabled = { |
| 152 |
"no-zmq" |
| 153 |
, "Disable ZMQ RPC server" |
| 154 |
}; |
| 155 |
|
| 156 |
} |
| 157 |
|
| 158 |
#endif |