Skip to content

配置 VPN

方法名

setVpnProfile

用法

  • 用法如下:
    js
    module.setVpnProfile({
      params: {
        key: "",
        ipsecCaCert:"",
        ipsecIdentifier:"",
        isMppeEnabled:false,
        name:"",
        type:1,
        password:"",
        ipsecServerCert:"",
        ipsecSecret:"",
        server:"",
        ipsecUserCert:"",
        l2tpSecret:"",
        username:""
      },
      complete: (res) => {
        console.log(res)
      }
    })
    js
    module.setVpnProfile({
      params: {
        key: "",
        ipsecCaCert:"",
        ipsecIdentifier:"",
        isMppeEnabled:false,
        name:"",
        type:1,
        password:"",
        ipsecServerCert:"",
        ipsecSecret:"",
        server:"",
        ipsecUserCert:"",
        l2tpSecret:"",
        username:""
      },
      complete: (res : LevenResult) => {
        console.log(res)
      }
    } as LevenOptions)
  • 参数说明
    参数名参数类型是否必填默认值参数描述
    paramsObject接口请求参数
    params.keyStringVPN 的唯一标识
    params.ipsecCaCertStringIPSec CA 证书
    params.ipsecIdentifierStringIPSec 标识符
    params.isMppeEnabledBoolean是否 PPP 加密
    params.nameStringVPN 的名称
    params.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
    params.passwordString密码
    params.ipsecServerCertStringIPSec 服务器证书
    params.ipsecSecretStringIPSec 预共享密钥
    params.serverString服务器名称
    params.ipsecUserCertStringIPSec 用户证书
    params.l2tpSecretStringL2TP 密钥
    params.usernameString用户名
    successFunction执行成功的函数
    failFunction执行失败的函数
    completeFunction执行完成的函数,不管成功还是失败都会执行

回调

  • 示例
    json
    {
        "data": {
          "result":true
        },
        "message": "",
        "code": 0
    }
  • 回调说明:
    参数名参数类型参数描述
    messageString消息提示
    dataObject数据对象
    data.resultBooleantrue:配置成功,false:配置失败
    codeInteger返回类型,0.成功,其他:失败