函数:getVPNList 获取 VPN 列表

函数名称:获取 VPN 列表

函数功能:获取 VPN 列表,返回一个 table

函数方法

list = getVPNList()

返回值 类型 说明
list string vpn 名称列表
  • 函数需要在设置界面调用才生效

函数用例

function file_exists(file_name) --检测指定文件是否存在
    local f = io.open(file_name, "r")
    return f ~= nil and f:close()
end
if  file_exists(userPath().."/plugin/vpncfg.tsl") == false then
    dialog("库文件不存在,请手动导入 vpncfg.tsl 文件到"..userPath().."/plugin 目录下", 0)
    lua_exit()
end
local tsld = loadTSLibrary("vpncfg.tsl") --库加载,返回一个 table
if tsld.granted == 0 then
    dialog("插件未授权!", 0)
    return
end
if tsld.status == 0 then --验证判断
    dialog("插件加载异常", 0)
    return
end
require("vpncfg") --需要加载
--以上代码请在脚本开头先调用验证加载,只需加载一次
list  = getVPNList()
local info = ""
    for k,v in pairs(list) do
        info = info .. k ..":"..v.."\n"
    end
    dialog(info, 0)
Copyright 北京帮你玩科技有限公司 2023 all right reserved,powered by Gitbook该文章修订时间: 2024-03-06 17:50:18

results matching ""

    No results matching ""