mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 11:17:49 +02:00
Add possibility to reseed from HTTPS URL
This commit is contained in:
parent
1d8d71cfb6
commit
0487e730ba
4 changed files with 14 additions and 8 deletions
14
Reseed.cpp
14
Reseed.cpp
|
@ -41,19 +41,23 @@ namespace data
|
|||
std::string filename; i2p::config::GetOption("reseed.file", filename);
|
||||
if (filename.length() > 0) // reseed file is specified
|
||||
{
|
||||
if (filename.length() > 8 && filename.substr(0, 8) == "https://")
|
||||
{
|
||||
return ReseedFromSU3 (filename); // reseed from https URL
|
||||
} else {
|
||||
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);
|
||||
std::string reseedUrl = httpsReseedHostList[ind] + "i2pseeds.su3";
|
||||
return ReseedFromSU3 (reseedUrl);
|
||||
}
|
||||
|
||||
int Reseeder::ReseedFromSU3 (const std::string& host)
|
||||
int Reseeder::ReseedFromSU3 (const std::string& url)
|
||||
{
|
||||
std::string url = host + "i2pseeds.su3";
|
||||
LogPrint (eLogInfo, "Reseed: Downloading SU3 from ", host);
|
||||
LogPrint (eLogInfo, "Reseed: Downloading SU3 from ", url);
|
||||
std::string su3 = HttpsRequest (url);
|
||||
if (su3.length () > 0)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue