mirror of https://github.com/aredn/aredn.git
Add LocalHost Connection Type (#109)
Add a connection type field to info.lua so the api can provide it to the newui Local Hosts display.
This commit is contained in:
parent
1c76248765
commit
79a57a0021
|
@ -504,6 +504,21 @@ function model.getCurrentDHCPLeases()
|
||||||
return leases
|
return leases
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-------------------------------------
|
||||||
|
-- Returns Local Host Connection Type
|
||||||
|
-------------------------------------
|
||||||
|
function model.getLocalCnxType(hostname)
|
||||||
|
if string.match(hostname,"localhost") then
|
||||||
|
return "Loopback"
|
||||||
|
elseif string.match(hostname,"dtdlink") then
|
||||||
|
return "DTD"
|
||||||
|
elseif hostname == string.lower( model.getNodeName() ) then
|
||||||
|
return "RF"
|
||||||
|
else
|
||||||
|
return "LAN"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
-- Returns Local Hosts
|
-- Returns Local Hosts
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
@ -521,11 +536,13 @@ function model.getLocalHosts()
|
||||||
if ip then
|
if ip then
|
||||||
local entry = {
|
local entry = {
|
||||||
["ip"] = ip,
|
["ip"] = ip,
|
||||||
["hostnames"] = { }
|
["hostnames"] = { },
|
||||||
|
["cnxtype"] = ""
|
||||||
}
|
}
|
||||||
local index = 0
|
local index = 0
|
||||||
for hostname in entries:gmatch("%S+") do
|
for hostname in entries:gmatch("%S+") do
|
||||||
hostname = string.gsub(hostname,".local.mesh$","")
|
hostname = string.gsub(hostname,".local.mesh$","")
|
||||||
|
entry["cnxtype"] = model.getLocalCnxType(hostname)
|
||||||
entry["hostnames"][index] = hostname
|
entry["hostnames"][index] = hostname
|
||||||
index = index + 1
|
index = index + 1
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue