|
|
@ -1,5 +1,5 @@ |
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2013-2016, The PurpleI2P Project |
|
|
|
* Copyright (c) 2013-2017, The PurpleI2P Project |
|
|
|
* |
|
|
|
* |
|
|
|
* This file is part of Purple i2pd project and licensed under BSD3 |
|
|
|
* This file is part of Purple i2pd project and licensed under BSD3 |
|
|
|
* |
|
|
|
* |
|
|
@ -27,8 +27,8 @@ namespace config { |
|
|
|
options_description m_OptionsDesc; |
|
|
|
options_description m_OptionsDesc; |
|
|
|
variables_map m_Options; |
|
|
|
variables_map m_Options; |
|
|
|
|
|
|
|
|
|
|
|
void Init() { |
|
|
|
void Init() |
|
|
|
|
|
|
|
{ |
|
|
|
options_description general("General options"); |
|
|
|
options_description general("General options"); |
|
|
|
general.add_options() |
|
|
|
general.add_options() |
|
|
|
("help", "Show this message") |
|
|
|
("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") |
|
|
|
("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") |
|
|
|
("ntcp", value<bool>()->default_value(true), "Enable NTCP transport") |
|
|
|
("ssu", value<bool>()->default_value(true), "Enable SSU 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 |
|
|
|
#ifdef _WIN32 |
|
|
|
("svcctl", value<std::string>()->default_value(""), "Windows service management ('install' or 'remove')") |
|
|
|
("svcctl", value<std::string>()->default_value(""), "Windows service management ('install' or 'remove')") |
|
|
|
("insomnia", value<bool>()->zero_tokens()->default_value(false), "Prevent system from sleeping") |
|
|
|
("insomnia", value<bool>()->zero_tokens()->default_value(false), "Prevent system from sleeping") |
|
|
@ -112,6 +112,7 @@ namespace config { |
|
|
|
("socksproxy.outbound.quantity", value<std::string>()->default_value("5"), "SOCKS proxy outbound tunnels quantity") |
|
|
|
("socksproxy.outbound.quantity", value<std::string>()->default_value("5"), "SOCKS proxy outbound tunnels quantity") |
|
|
|
("socksproxy.latency.min", value<std::string>()->default_value("0"), "SOCKS proxy min latency for tunnels") |
|
|
|
("socksproxy.latency.min", value<std::string>()->default_value("0"), "SOCKS proxy min latency for tunnels") |
|
|
|
("socksproxy.latency.max", value<std::string>()->default_value("0"), "SOCKS proxy max latency for tunnels") |
|
|
|
("socksproxy.latency.max", value<std::string>()->default_value("0"), "SOCKS proxy max latency for tunnels") |
|
|
|
|
|
|
|
("socksproxy.outproxy.enabled", value<bool>()->default_value(false), "Enable or disable SOCKS outproxy") |
|
|
|
("socksproxy.outproxy", value<std::string>()->default_value("127.0.0.1"), "Upstream outproxy address for SOCKS Proxy") |
|
|
|
("socksproxy.outproxy", value<std::string>()->default_value("127.0.0.1"), "Upstream outproxy address for SOCKS Proxy") |
|
|
|
("socksproxy.outproxyport", value<uint16_t>()->default_value(9050), "Upstream outproxy port for SOCKS Proxy") |
|
|
|
("socksproxy.outproxyport", value<uint16_t>()->default_value(9050), "Upstream outproxy port for SOCKS Proxy") |
|
|
|
; |
|
|
|
; |
|
|
@ -179,8 +180,8 @@ namespace config { |
|
|
|
"https://reseed.i2p-projekt.de/," |
|
|
|
"https://reseed.i2p-projekt.de/," |
|
|
|
"https://i2p.mooo.com/netDb/," |
|
|
|
"https://i2p.mooo.com/netDb/," |
|
|
|
"https://netdb.i2p2.no/," |
|
|
|
"https://netdb.i2p2.no/," |
|
|
|
// "https://us.reseed.i2p2.no:444/," // mamoth's shit
|
|
|
|
// "https://us.reseed.i2p2.no:444/," // mamoth's shit
|
|
|
|
// "https://uk.reseed.i2p2.no:444/," // mamoth's shit
|
|
|
|
// "https://uk.reseed.i2p2.no:444/," // mamoth's shit
|
|
|
|
"https://i2p-0.manas.ca:8443/," |
|
|
|
"https://i2p-0.manas.ca:8443/," |
|
|
|
"https://download.xxlspeed.com/," |
|
|
|
"https://download.xxlspeed.com/," |
|
|
|
"https://reseed-ru.lngserv.ru/," |
|
|
|
"https://reseed-ru.lngserv.ru/," |
|
|
@ -197,28 +198,30 @@ namespace config { |
|
|
|
("addressbook.defaulturl", value<std::string>()->default_value( |
|
|
|
("addressbook.defaulturl", value<std::string>()->default_value( |
|
|
|
"http://joajgazyztfssty4w2on5oaqksz6tqoxbduy553y34mf4byv6gpq.b32.i2p/export/alive-hosts.txt" |
|
|
|
"http://joajgazyztfssty4w2on5oaqksz6tqoxbduy553y34mf4byv6gpq.b32.i2p/export/alive-hosts.txt" |
|
|
|
), "AddressBook subscription URL for initial setup") |
|
|
|
), "AddressBook subscription URL for initial setup") |
|
|
|
("addressbook.subscriptions", value<std::string>()->default_value(""), |
|
|
|
("addressbook.subscriptions", value<std::string>()->default_value(""), "AddressBook subscriptions URLs, separated by comma"); |
|
|
|
"AddressBook subscriptions URLs, separated by comma"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
options_description trust("Trust options"); |
|
|
|
options_description trust("Trust options"); |
|
|
|
trust.add_options() |
|
|
|
trust.add_options() |
|
|
|
("trust.enabled", value<bool>()->default_value(false), "Enable explicit trust 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.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.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"); |
|
|
|
options_description websocket("Websocket Options"); |
|
|
|
websocket.add_options() |
|
|
|
websocket.add_options() |
|
|
|
("websockets.enabled", value<bool>()->default_value(false), "enable websocket server") |
|
|
|
("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.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.port", value<uint16_t>()->default_value(7666), "Port to bind websocket server on") |
|
|
|
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
options_description exploratory("Exploratory Options"); |
|
|
|
options_description exploratory("Exploratory Options"); |
|
|
|
exploratory.add_options() |
|
|
|
exploratory.add_options() |
|
|
|
("exploratory.inbound.length", value<int>()->default_value(2), "Exploratory inbound tunnel length") |
|
|
|
("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.outbound.length", value<int>()->default_value(2), "Exploratory outbound tunnel length") |
|
|
|
("exploratory.inbound.quantity", value<int>()->default_value(3), "Exploratory inbound tunnels quantity") |
|
|
|
("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 |
|
|
|
m_OptionsDesc |
|
|
|
.add(general) |
|
|
|
.add(general) |
|
|
@ -266,7 +269,8 @@ namespace config { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ParseConfig(const std::string& path) { |
|
|
|
void ParseConfig(const std::string& path) |
|
|
|
|
|
|
|
{ |
|
|
|
if (path == "") return; |
|
|
|
if (path == "") return; |
|
|
|
|
|
|
|
|
|
|
|
std::ifstream config(path, std::ios::in); |
|
|
|
std::ifstream config(path, std::ios::in); |
|
|
@ -288,11 +292,13 @@ namespace config { |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Finalize() { |
|
|
|
void Finalize() |
|
|
|
|
|
|
|
{ |
|
|
|
notify(m_Options); |
|
|
|
notify(m_Options); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool IsDefault(const char *name) { |
|
|
|
bool IsDefault(const char *name) |
|
|
|
|
|
|
|
{ |
|
|
|
if (!m_Options.count(name)) |
|
|
|
if (!m_Options.count(name)) |
|
|
|
throw "try to check non-existent option"; |
|
|
|
throw "try to check non-existent option"; |
|
|
|
|
|
|
|
|
|
|
@ -301,7 +307,8 @@ namespace config { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool GetOptionAsAny(const char *name, boost::any& value) { |
|
|
|
bool GetOptionAsAny(const char *name, boost::any& value) |
|
|
|
|
|
|
|
{ |
|
|
|
if (!m_Options.count(name)) |
|
|
|
if (!m_Options.count(name)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
value = m_Options[name]; |
|
|
|
value = m_Options[name]; |
|
|
|