| 240 | } |
| 241 | |
| 242 | void 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 | |
| 271 | static void PollTorWebsite() { |
| 272 | boost::scoped_ptr<CIPGroup> group(LoadTorIPsFromWeb()); |
no outgoing calls