MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / InitIPGroupsFromCommandLine

Function InitIPGroupsFromCommandLine

src/ipgroups.cpp:242–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

240}
241
242void InitIPGroupsFromCommandLine() {
243 // Allow IP groups to be loaded from a file passed in via the command line.
244 vector<string> &srcs = mapMultiArgs[IP_PRIO_SRC_FLAG_NAME];
245 BOOST_FOREACH(const string &src, srcs)
246 {
247 vector<string> pieces;
248 boost::split(pieces, src, boost::is_any_of(","));
249 if (pieces.size() != 3) {
250 LogPrintf("The -ip-priority-source flag takes a triple of name,priority,file_name: you gave: %s\n", src);
251 continue;
252 }
253
254 string &group_name = pieces[0];
255 int prio = atoi(pieces[1].c_str());
256 if (prio == 0) {
257 LogPrintf("IP Priority: Could not parse %s as an integer or priority of zero would be useless\n", pieces[1]);
258 continue;
259 }
260 string &file_name = pieces[2];
261
262 boost::filesystem::path file_path(file_name);
263 boost::filesystem::path path = file_path.is_complete() ? file_path : GetDataDir(false) / file_name;
264
265 if (!LoadIPGroupsFromFile(path, group_name, prio)) {
266 MaybeRemoveGroup(group_name);
267 }
268 }
269}
270
271static void PollTorWebsite() {
272 boost::scoped_ptr<CIPGroup> group(LoadTorIPsFromWeb());

Callers 2

InitIPGroupsFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85

Calls

no outgoing calls

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.68