Add local networks alias configuration

Closes #2476
This commit is contained in:
emanuele-f 2019-03-25 16:46:54 +01:00
parent 79543c6207
commit 54becd3b22
6 changed files with 58 additions and 4 deletions

View file

@ -1571,6 +1571,48 @@ function flowinfo2process(process, host_info_to_url)
return fmt
end
-- ##############################################
function getLocalNetworkAliassKey()
return "ntopng.network_aliases"
end
-- ##############################################
function getLocalNetworkAlias(network)
local alias = ntop.getHashCache(getLocalNetworkAliassKey(), network)
if not isEmptyString(alias) then
return alias
end
return network
end
-- ##############################################
function getFullLocalNetworkName(network)
local alias = getLocalNetworkAlias(network)
if alias ~= network then
return string.format("%s [%s]", alias, network)
end
return network
end
-- ##############################################
function setLocalNetworkAlias(network, alias)
if((network ~= alias) or isEmptyString(alias)) then
ntop.setHashCache(getLocalNetworkAliassKey(), network, alias)
else
ntop.delHashCache(getLocalNetworkAliassKey(), network)
end
end
-- ##############################################
-- URL Util --
--