geoip part - the format for geopip now with unique name
* this cos we will also implement a new cdn api tool to detect vpn access and real ip clients
This commit is contained in:
parent
755549525b
commit
31542d73da
@ -53,7 +53,7 @@ if not governing.modgeoip then
|
||||
if not ip then return true, "[geoip] no ip available! seems "..param.." does not provide such info!" end
|
||||
|
||||
governing.lookup(ip, function(result)
|
||||
local txt = format_result(result)
|
||||
local txt = format_result_geoip(result)
|
||||
if not txt then return true, "[geoip]: "..param..":"..ip" error: "..(result.description or "unknown error") end
|
||||
minetest.log("action", "[geoip] "..param..": "..txt)
|
||||
minetest.chat_send_player(name, param..": "..txt)
|
||||
@ -62,3 +62,4 @@ if not governing.modgeoip then
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
function format_result(result)
|
||||
function format_result_geoip(result)
|
||||
if result and result.status == "success" and result.data and result.data.geo then
|
||||
local txt = " Place: "
|
||||
if result.data.geo.ip then
|
||||
@ -55,7 +55,7 @@ if not governing.modgeoip then
|
||||
local ip = minetest.get_player_ip(name)
|
||||
if not ip then return end
|
||||
governing.lookup(ip, function(data) -- log, but TODO: record in storage log file
|
||||
local txt = format_result(data)
|
||||
local txt = format_result_geoip(data)
|
||||
if txt then minetest.log("warning", "[goberning/geoip] joined player, " .. name .. ":" .. ip .. "," .. txt)
|
||||
else minetest.log("error", "[goberning/geoip] joined player, " .. name .. ":" .. ip .. ", seems fails")
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user