diff --git a/zh-cn/application-dev/connectivity/net-vpn.md b/zh-cn/application-dev/connectivity/net-vpn.md index 496986e03e63b65034c4e059a3543fb13a08009b..55e0e7dee1094df35627763576d4aed6fa297168 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 fcee1e759e9f050cd55bedef089f22e870cb3c90..a1d807a49578e088221ef57c710635f2d747e981 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 797b14388ef921ee3372e16db0cd702bdc720721..3d404f999de6f3a5d5ef522ff46ff98153add1f1 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