mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-23 17:36:37 +02:00
reseed from file
This commit is contained in:
parent
82d80d2ead
commit
8e849ea6f8
2 changed files with 20 additions and 6 deletions
18
Config.cpp
18
Config.cpp
|
@ -147,12 +147,17 @@ namespace config {
|
||||||
#endif
|
#endif
|
||||||
"Enable or disable elgamal precomputation table")
|
"Enable or disable elgamal precomputation table")
|
||||||
;
|
;
|
||||||
|
|
||||||
|
options_description reseed("Reseed options");
|
||||||
|
reseed.add_options()
|
||||||
|
("reseed.file", value<std::string>()->default_value(""), "Path to .su3 file")
|
||||||
|
;
|
||||||
|
|
||||||
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.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?");
|
||||||
|
|
||||||
m_OptionsDesc
|
m_OptionsDesc
|
||||||
.add(general)
|
.add(general)
|
||||||
|
@ -166,7 +171,8 @@ namespace config {
|
||||||
.add(i2pcontrol)
|
.add(i2pcontrol)
|
||||||
.add(upnp)
|
.add(upnp)
|
||||||
.add(precomputation)
|
.add(precomputation)
|
||||||
.add(trust)
|
.add(reseed)
|
||||||
|
.add(trust)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "NetDb.h"
|
#include "NetDb.h"
|
||||||
#include "HTTP.h"
|
#include "HTTP.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
namespace i2p
|
namespace i2p
|
||||||
{
|
{
|
||||||
|
@ -51,6 +52,13 @@ namespace data
|
||||||
|
|
||||||
int Reseeder::ReseedNowSU3 ()
|
int Reseeder::ReseedNowSU3 ()
|
||||||
{
|
{
|
||||||
|
std::string filename; i2p::config::GetOption("reseed.file", filename);
|
||||||
|
if (filename.length() > 0) // reseed file is specified
|
||||||
|
{
|
||||||
|
auto num = ProcessSU3File (filename.c_str ());
|
||||||
|
if (num > 0) return num; // success
|
||||||
|
LogPrint (eLogWarning, "Can't reseed from ", filename, " . Trying from hosts");
|
||||||
|
}
|
||||||
auto ind = rand () % httpsReseedHostList.size ();
|
auto ind = rand () % httpsReseedHostList.size ();
|
||||||
std::string& reseedHost = httpsReseedHostList[ind];
|
std::string& reseedHost = httpsReseedHostList[ind];
|
||||||
return ReseedFromSU3 (reseedHost);
|
return ReseedFromSU3 (reseedHost);
|
||||||
|
|
Loading…
Add table
Reference in a new issue