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.keyString是无VPN 的唯一标识
    params.ipsecCaCertString是无IPSec CA 证书
    params.ipsecIdentifierString是无IPSec 标识符
    params.isMppeEnabledBoolean是无是否 PPP 加密
    params.nameString是无VPN 的名称
    params.typeInteger是无VPN 的类型,有效范围 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.ipsecServerCertString是无IPSec 服务器证书
    params.ipsecSecretString是无IPSec 预共享密钥
    params.serverString是无服务器名称
    params.ipsecUserCertString是无IPSec 用户证书
    params.l2tpSecretString是无L2TP 密钥
    params.usernameString是无用户名
    successFunction否无执行成功的函数
    failFunction否无执行失败的函数
    completeFunction否无执行完成的函数,不管成功还是失败都会执行

回调 ​

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