Browse Source

reseed from file

pull/604/head
orignal 8 years ago
parent
commit
8e849ea6f8
  1. 16
      Config.cpp
  2. 8
      Reseed.cpp

16
Config.cpp

@ -148,11 +148,16 @@ namespace config { @@ -148,11 +148,16 @@ namespace config {
"Enable or disable elgamal precomputation table")
;
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.hidden", value<bool>()->default_value(false), "should we hide our router from other routers?");
options_description reseed("Reseed options");
reseed.add_options()
("reseed.file", value<std::string>()->default_value(""), "Path to .su3 file")
;
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.hidden", value<bool>()->default_value(false), "should we hide our router from other routers?");
m_OptionsDesc
.add(general)
@ -166,6 +171,7 @@ namespace config { @@ -166,6 +171,7 @@ namespace config {
.add(i2pcontrol)
.add(upnp)
.add(precomputation)
.add(reseed)
.add(trust)
;
}

8
Reseed.cpp

@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
#include "NetDb.h"
#include "HTTP.h"
#include "util.h"
#include "Config.h"
namespace i2p
{
@ -51,6 +52,13 @@ namespace data @@ -51,6 +52,13 @@ namespace data
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 ();
std::string& reseedHost = httpsReseedHostList[ind];
return ReseedFromSU3 (reseedHost);

Loading…
Cancel
Save