@brief tries to bootstrap into I2P network (from local files and servers, with respect of options) */
| 49 | @brief tries to bootstrap into I2P network (from local files and servers, with respect of options) |
| 50 | */ |
| 51 | void Reseeder::Bootstrap () |
| 52 | { |
| 53 | std::string su3FileName; i2p::config::GetOption("reseed.file", su3FileName); |
| 54 | std::string zipFileName; i2p::config::GetOption("reseed.zipfile", zipFileName); |
| 55 | |
| 56 | if (su3FileName.length() > 0) // bootstrap from SU3 file or URL |
| 57 | { |
| 58 | int num; |
| 59 | if (su3FileName.length() > 8 && su3FileName.substr(0, 8) == "https://") |
| 60 | { |
| 61 | num = ReseedFromSU3Url (su3FileName); // from https URL |
| 62 | } |
| 63 | else |
| 64 | { |
| 65 | num = ProcessSU3File (su3FileName.c_str ()); |
| 66 | } |
| 67 | if (num == 0) |
| 68 | LogPrint (eLogWarning, "Reseed: Failed to reseed from ", su3FileName); |
| 69 | } |
| 70 | else if (zipFileName.length() > 0) // bootstrap from ZIP file |
| 71 | { |
| 72 | int num = ProcessZIPFile (zipFileName.c_str ()); |
| 73 | if (num == 0) |
| 74 | LogPrint (eLogWarning, "Reseed: Failed to reseed from ", zipFileName); |
| 75 | } |
| 76 | else // bootstrap from reseed servers |
| 77 | { |
| 78 | int num = ReseedFromServers (); |
| 79 | if (num == 0) |
| 80 | LogPrint (eLogWarning, "Reseed: Failed to reseed from servers"); |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * @brief bootstrap from random server, retry 10 times |