Fix tunnel disply order (#286)

This commit is contained in:
Tim Wilkinson 2022-03-11 13:59:50 -08:00 committed by GitHub
parent d03be0c2ae
commit 8409ffe6ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 28 deletions

View File

@ -210,23 +210,19 @@ end
local gci_vars = { "enabled", "name", "passwd", "netip", "contact" }
function get_client_info()
local c = 0
local all = cursor:get_all("vtun")
if all then
for _, myclient in pairs(all)
do
if myclient[".type"] == "client" then
for _, var in ipairs(gci_vars)
do
local key = "client" .. c .. "_" .. var
parms[key] = myclient[var]
if not parms[key] then
parms[key] = ""
end
cursor:foreach("vtun", "client",
function(section)
for _, var in ipairs(gci_vars)
do
local key = "client" .. c .. "_" .. var
parms[key] = section[var]
if not parms[key] then
parms[key] = ""
end
c = c + 1
end
c = c + 1
end
end
)
parms.client_num = c
end

View File

@ -194,23 +194,19 @@ end
local gci_vars = { "enabled", "host", "passwd", "netip", "contact" }
function get_connection_info()
local c = 0
local conns = cursor:get_all("vtun")
if conns then
for _, myconn in pairs(conns)
do
if myconn[".type"] == "server" then
for _, var in ipairs(gci_vars)
do
local key = "conn" .. c .. "_" .. var
parms[key] = myconn[var]
if not parms[key] then
parms[key] = ""
end
cursor:foreach("vtun", "server",
function(section)
for _, var in ipairs(gci_vars)
do
local key = "conn" .. c .. "_" .. var
parms[key] = section[var]
if not parms[key] then
parms[key] = ""
end
c = c + 1
end
c = c + 1
end
end
)
parms.conn_num = c
end