mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-23 05:06:31 +00:00
tabulation workout on Config.cpp
This commit is contained in:
parent
d7b412c1eb
commit
16d3440a4c
@ -27,8 +27,8 @@ namespace config {
|
||||
options_description m_OptionsDesc;
|
||||
variables_map m_Options;
|
||||
|
||||
void Init() {
|
||||
|
||||
void Init()
|
||||
{
|
||||
options_description general("General options");
|
||||
general.add_options()
|
||||
("help", "Show this message")
|
||||
@ -57,7 +57,7 @@ namespace config {
|
||||
("share", value<int>()->default_value(100), "Limit of transit traffic from max bandwidth in percents. (default: 100")
|
||||
("ntcp", value<bool>()->default_value(true), "Enable NTCP transport")
|
||||
("ssu", value<bool>()->default_value(true), "Enable SSU transport")
|
||||
("ntcpproxy", value<std::string>()->default_value(""), "proxy url for ntcp transport")
|
||||
("ntcpproxy", value<std::string>()->default_value(""), "Proxy URL for NTCP transport")
|
||||
#ifdef _WIN32
|
||||
("svcctl", value<std::string>()->default_value(""), "Windows service management ('install' or 'remove')")
|
||||
("insomnia", value<bool>()->zero_tokens()->default_value(false), "Prevent system from sleeping")
|
||||
@ -197,28 +197,30 @@ namespace config {
|
||||
("addressbook.defaulturl", value<std::string>()->default_value(
|
||||
"http://joajgazyztfssty4w2on5oaqksz6tqoxbduy553y34mf4byv6gpq.b32.i2p/export/alive-hosts.txt"
|
||||
), "AddressBook subscription URL for initial setup")
|
||||
("addressbook.subscriptions", value<std::string>()->default_value(""),
|
||||
"AddressBook subscriptions URLs, separated by comma");
|
||||
("addressbook.subscriptions", value<std::string>()->default_value(""), "AddressBook subscriptions URLs, separated by comma");
|
||||
|
||||
options_description trust("Trust options");
|
||||
trust.add_options()
|
||||
("trust.enabled", value<bool>()->default_value(false), "Enable explicit trust options")
|
||||
("trust.family", value<std::string>()->default_value(""), "Router Familiy to trust for first hops")
|
||||
("trust.routers", value<std::string>()->default_value(""), "Only Connect to these routers")
|
||||
("trust.hidden", value<bool>()->default_value(false), "Should we hide our router from other routers?");
|
||||
("trust.hidden", value<bool>()->default_value(false), "Should we hide our router from other routers?")
|
||||
;
|
||||
|
||||
options_description websocket("Websocket Options");
|
||||
websocket.add_options()
|
||||
("websockets.enabled", value<bool>()->default_value(false), "enable websocket server")
|
||||
("websockets.address", value<std::string>()->default_value("127.0.0.1"), "address to bind websocket server on")
|
||||
("websockets.port", value<uint16_t>()->default_value(7666), "port to bind websocket server on");
|
||||
("websockets.enabled", value<bool>()->default_value(false), "Enable websocket server")
|
||||
("websockets.address", value<std::string>()->default_value("127.0.0.1"), "Address to bind websocket server on")
|
||||
("websockets.port", value<uint16_t>()->default_value(7666), "Port to bind websocket server on")
|
||||
;
|
||||
|
||||
options_description exploratory("Exploratory Options");
|
||||
exploratory.add_options()
|
||||
("exploratory.inbound.length", value<int>()->default_value(2), "Exploratory inbound tunnel length")
|
||||
("exploratory.outbound.length", value<int>()->default_value(2), "Exploratory outbound tunnel length")
|
||||
("exploratory.inbound.quantity", value<int>()->default_value(3), "Exploratory inbound tunnels quantity")
|
||||
("exploratory.outbound.quantity", value<int>()->default_value(3), "Exploratory outbound tunnels quantity");
|
||||
("exploratory.outbound.quantity", value<int>()->default_value(3), "Exploratory outbound tunnels quantity")
|
||||
;
|
||||
|
||||
m_OptionsDesc
|
||||
.add(general)
|
||||
@ -266,7 +268,8 @@ namespace config {
|
||||
}
|
||||
}
|
||||
|
||||
void ParseConfig(const std::string& path) {
|
||||
void ParseConfig(const std::string& path)
|
||||
{
|
||||
if (path == "") return;
|
||||
|
||||
std::ifstream config(path, std::ios::in);
|
||||
@ -288,11 +291,13 @@ namespace config {
|
||||
};
|
||||
}
|
||||
|
||||
void Finalize() {
|
||||
void Finalize()
|
||||
{
|
||||
notify(m_Options);
|
||||
}
|
||||
|
||||
bool IsDefault(const char *name) {
|
||||
bool IsDefault(const char *name)
|
||||
{
|
||||
if (!m_Options.count(name))
|
||||
throw "try to check non-existent option";
|
||||
|
||||
@ -301,7 +306,8 @@ namespace config {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GetOptionAsAny(const char *name, boost::any& value) {
|
||||
bool GetOptionAsAny(const char *name, boost::any& value)
|
||||
{
|
||||
if (!m_Options.count(name))
|
||||
return false;
|
||||
value = m_Options[name];
|
||||
|
Loading…
x
Reference in New Issue
Block a user