MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / ipIsLocal

Function ipIsLocal

plugins/plugin_utils/plugin_HTTP.cpp:316–335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314}
315
316bool ipIsLocal(const std::string& ip) {
317 std::vector<std::string> v = tokenize(ip, std::string("."), 0, false);
318 if (v.size() < 4) {
319 return true;
320 }
321
322 if (v[0] == "127" || v[0] == "10") {
323 return true;
324 }
325
326 if (v[0] == "192" && v[1] == "168") {
327 return true;
328 }
329
330 if (v[0] == "172" && ((atoi(v[1].c_str()) >= 16) && (atoi(v[1].c_str()) <= 31))) {
331 return true;
332 }
333
334 return false;
335}
336
337bool BZFSHTTPAuth::verifyToken(const HTTPRequest& request, HTTPReply& reply) {
338 // build up the groups list

Callers 1

verifyTokenMethod · 0.85

Calls 3

c_strMethod · 0.80
tokenizeFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected