Implement countries serialization

Countries now show the cumulative traffic since ntopng restart as this is consistent with the other views
This commit is contained in:
emanuele-f 2019-05-27 13:07:30 +02:00
parent c09199690f
commit 8fcce457c9
18 changed files with 313 additions and 45 deletions

View file

@ -0,0 +1,27 @@
--
-- (C) 2013-19 - ntop.org
--
dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
require "lua_utils"
require "country_utils"
local json = require("dkjson")
sendHTTPContentTypeHeader('text/html')
-- sendHTTPHeader('application/json')
interface.select(ifname)
local country = _GET["country"]
interface.select(ifname)
local country = interface.getCountryInfo(country)
local res = {}
if country ~= nil then
res = country2record(getInterfaceId(ifname), country)
end
print(json.encode(res, nil))