| 61 | } |
| 62 | |
| 63 | vector<CSubNet> ParseIPData(string input) { |
| 64 | vector<string> lines; |
| 65 | vector<CSubNet> results; |
| 66 | boost::split(lines, input, boost::is_any_of("\n")); |
| 67 | for (size_t i = 0; i < lines.size(); i++) { |
| 68 | // Skip empty lines and comments. |
| 69 | if (lines[i].size() == 0) continue; |
| 70 | if (lines[i][0] == '#') continue; |
| 71 | |
| 72 | CSubNet subNet(lines[i]); |
| 73 | if (!subNet.IsValid()) { |
| 74 | LogPrintf("Failed to parse IP address from IP data file at line %d: %s\n", i, SanitizeString(lines[i])); |
| 75 | continue; |
| 76 | } |
| 77 | results.push_back(subNet); |
| 78 | } |
| 79 | return results; |
| 80 | } |
| 81 | |
| 82 | // Hack around the fact that some platforms, especially on Linux, have root stores |
| 83 | // that openssl/curl can't find by default. This is the root cert used by check.torproject.org |