From ea10dce2cf63efc556d183bc1c4a04291bfecf95 Mon Sep 17 00:00:00 2001 From: xujie Date: Thu, 20 Jul 2023 16:25:58 +0800 Subject: [PATCH] Fix review issue Change-Id: Iad7f353a3a7f18378810c6e291d5721e58e0e16d Signed-off-by: xujie --- zh-cn/application-dev/connectivity/net-vpn.md | 2 +- .../reference/apis/js-apis-net-vpn.md | 19 ++++++++----------- .../reference/errorcodes/errorcode-net-vpn.md | 4 ++-- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/zh-cn/application-dev/connectivity/net-vpn.md b/zh-cn/application-dev/connectivity/net-vpn.md index 496986e03e..55e0e7dee1 100644 --- a/zh-cn/application-dev/connectivity/net-vpn.md +++ b/zh-cn/application-dev/connectivity/net-vpn.md @@ -49,7 +49,7 @@ let VpnConnection = vpn.createVpnConnection(globalThis.context) @Entry @Component struct Index { - @State message: string = 'Toy VPN' + @State message: string = 'Test VPN' CreateTunnel() { TunnelFd = vpn_client.tcpConnect("192.168.43.208", 8888) diff --git a/zh-cn/application-dev/reference/apis/js-apis-net-vpn.md b/zh-cn/application-dev/reference/apis/js-apis-net-vpn.md index fcee1e759e..a1d807a495 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-net-vpn.md +++ b/zh-cn/application-dev/reference/apis/js-apis-net-vpn.md @@ -174,8 +174,8 @@ setUp(config: VpnConfig): Promise\; dnsAddresses:[ "114.114.114.114" ], - acceptedApplications:[], - refusedApplications:[] + trustedApplications:[], + blockedApplications:[] } VpnConnection.setUp(config).then((data) => { console.info(TAG + "setUp success, tunfd: " + JSON.stringify(data)) @@ -236,9 +236,8 @@ protect(socketFd: number, callback: AsyncCallback\): void; }) tcp.getSocketFd().then((tunnelfd) => { console.info("tunenlfd: " + tunnelfd); - VpnConnection.protect(tunnelfd, (error, data) => { + VpnConnection.protect(tunnelfd, (error) => { console.info(JSON.stringify(error)); - console.info(JSON.stringify(data)); }) }) ``` @@ -300,8 +299,8 @@ protect(socketFd: number): Promise\; }) tcp.getSocketFd().then((tunnelfd) => { console.info("tunenlfd: " + tunnelfd); - VpnConnection.protect(tunnelfd).then((data) => { - console.info("protect success" + JSON.stringify(data)) + VpnConnection.protect(tunnelfd).then(() => { + console.info("protect success.") }).catch(err => { console.info("protect fail" + JSON.stringify(err)) }) @@ -341,9 +340,8 @@ destroy(callback: AsyncCallback\): void; **示例:** ```js - VpnConnection.destroy((error, data) => { + VpnConnection.destroy((error) => { console.info(JSON.stringify(error)); - console.info(JSON.stringify(data)); }) ``` @@ -373,15 +371,14 @@ destroy(): Promise\; | ------- | ----------------------------- | | 201 | Permission denied. | | 202 | Non-system applications use system APIs. | -| 401 | Parameter error. | | 2200002 | Operation failed. Cannot connect to service. | | 2100003 | System internal error. | **示例:** ```js - VpnConnection.destroy().then((data) => { - console.info("destroy success" + JSON.stringify(data)) + VpnConnection.destroy().then(() => { + console.info("destroy success.") }).catch(err => { console.info("destroy fail" + JSON.stringify(err)) }); diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-net-vpn.md b/zh-cn/application-dev/reference/errorcodes/errorcode-net-vpn.md index 797b14388e..3d404f999d 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-net-vpn.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-net-vpn.md @@ -31,7 +31,7 @@ VPN exist already, please execute destroy first. **错误描述** -VPN已经存在,请先执行destory接口。 +VPN连接已存在,请先调用destroy接口销毁VPN连接。 **可能原因** @@ -58,4 +58,4 @@ tcp链路建立失败。 **处理步骤** -检查tcp链路是否建立成功。 \ No newline at end of file +检查socket链路是否建立成功。 \ No newline at end of file -- GitLab