Skip to content

根据指定的 key 获取对应的 VPN 文件

方法名

getVpnProfile

用法

  • 用法如下:
    js
    module.getVpnProfile({
      params: {
        key: ""
      },
      complete: (res) => {
        console.log(res)
      }
    })
    js
    module.getVpnProfile({
      params: {
        key: ""
      },
      complete: (res : LevenResult) => {
        console.log(res)
      }
    } as LevenOptions)
  • 参数说明
    参数名参数类型是否必填默认值参数描述
    paramsObject接口请求参数
    params.keyStringVPN 的唯一标识
    successFunction执行成功的函数
    failFunction执行失败的函数
    completeFunction执行完成的函数,不管成功还是失败都会执行

回调

  • 示例
    json
    {
        "data": {
          "result":{
            "key": "",
            "ipsecCaCert":"",
            "ipsecIdentifier":"",
            "isMppeEnabled":false,
            "name":"",
            "type":1,
            "password":"",
            "ipsecServerCert":"",
            "ipsecSecret":"",
            "server":"",
            "ipsecUserCert":"",
            "l2tpSecret":"",
            "username":""
          }
        },
        "message": "",
        "code": 0
    }
  • 回调说明:
    参数名参数类型参数描述
    messageString消息提示
    dataObject数据对象
    data.resultObject获取结果
    data.result.keyStringVPN 的唯一标识
    data.result.ipsecCaCertStringIPSec CA 证书
    data.result.ipsecIdentifierStringIPSec 标识符
    data.result.isMppeEnabledBoolean是否 PPP 加密
    data.result.nameStringVPN 的名称
    data.result.typeIntegerVPN 的类型,有效范围 0-6
    0:TYPE_PPTP
    1:TYPE_L2TP
    2:TYPE_L2TP_IPSEC_PSK
    3:TYPE_L2TP_IPSEC_RSA
    4:TYPE_IPSEC_XAUTH_PSK
    5:TYPE_IPSEC_XAUTH_RSA
    6:TYPE_IPSEC_HYBRID_RSA
    data.result.passwordString密码
    data.result.ipsecServerCertStringIPSec 服务器证书
    data.result.ipsecSecretStringIPSec 预共享密钥
    data.result.serverString服务器名称
    data.result.ipsecUserCertStringIPSec 用户证书
    data.result.l2tpSecretStringL2TP 密钥
    data.result.usernameString用户名
    codeInteger返回类型,0.成功,其他:失败